Skip to content

Commit

Permalink
Merge pull request #4013 from KBVE/patch-atomic-adding-lasers-02-19-2…
Browse files Browse the repository at this point in the history
…025-1740002766

[CI] Merge patch-atomic-adding-lasers-02-19-2025-1740002766 into dev
  • Loading branch information
h0lybyte authored Feb 20, 2025
2 parents 81e7e19 + 0c394e1 commit e86dddb
Show file tree
Hide file tree
Showing 11 changed files with 124 additions and 6 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://cpg870sshds0m"
path="res://.godot/imported/laserGreen11.png-776296bf2871b1464fd65317ea694ad5.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/kenny/space-shooter-redux/png/laserGreen11.png"
dest_files=["res://.godot/imported/laserGreen11.png-776296bf2871b1464fd65317ea694ad5.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
5 changes: 5 additions & 0 deletions apps/gamejam/brackeys/13/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ drift_right={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null)
]
}
shoot={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
]
}

[layer_names]

Expand Down
6 changes: 5 additions & 1 deletion apps/gamejam/brackeys/13/scenes/game.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
[gd_scene load_steps=2 format=3 uid="uid://cbrda40vq26pj"]
[gd_scene load_steps=3 format=3 uid="uid://cbrda40vq26pj"]

[ext_resource type="Script" path="res://scripts/game.gd" id="1_oyaqx"]
[ext_resource type="PackedScene" uid="uid://1s5v0llrjq3" path="res://scenes/spaceship.tscn" id="1_rlyye"]

[node name="Game" type="Node2D"]
script = ExtResource("1_oyaqx")

[node name="Spaceship" parent="." instance=ExtResource("1_rlyye")]
position = Vector2(500, 300)

[node name="Projectiles" type="Node" parent="."]
26 changes: 26 additions & 0 deletions apps/gamejam/brackeys/13/scenes/laser.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[gd_scene load_steps=4 format=3 uid="uid://dd2eekysgtc4"]

[ext_resource type="Script" path="res://scripts/laser.gd" id="1_5kyoc"]
[ext_resource type="Texture2D" uid="uid://cpg870sshds0m" path="res://assets/kenny/space-shooter-redux/png/laserGreen11.png" id="1_s4xlg"]

[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_44da2"]
radius = 3.0
height = 28.0

[node name="Laser" type="Area2D"]
collision_layer = 256
collision_mask = 216
script = ExtResource("1_5kyoc")

[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(0, -15)
scale = Vector2(0.5, 0.5)
texture = ExtResource("1_s4xlg")

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -15)
shape = SubResource("CapsuleShape2D_44da2")

[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
position = Vector2(0, -14.5)
scale = Vector2(0.5, 1.35)
7 changes: 6 additions & 1 deletion apps/gamejam/brackeys/13/scenes/spaceship.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@
[ext_resource type="Script" path="res://scripts/spaceship.gd" id="1_uejed"]

[sub_resource type="CircleShape2D" id="CircleShape2D_s734v"]
radius = 40.05
radius = 20.91

[node name="Spaceship" type="CharacterBody2D"]
collision_layer = 32
collision_mask = 472
script = ExtResource("1_uejed")

[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(0, -1)
scale = Vector2(0.4, 0.4)
texture = ExtResource("1_8hcjj")

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 4)
rotation = -0.0497135
shape = SubResource("CircleShape2D_s734v")

[node name="OmniScope" type="Node2D" parent="."]
10 changes: 10 additions & 0 deletions apps/gamejam/brackeys/13/scripts/game.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends Node2D

@onready var spaceship = $Spaceship
@onready var projectiles = $Projectiles

func _ready():
spaceship.connect("laser_shot", _on_spaceship_laser_shot)

func _on_spaceship_laser_shot(laser):
projectiles.add_child(laser)
12 changes: 8 additions & 4 deletions apps/gamejam/brackeys/13/scripts/global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ var resources := {
}

var base_starship_stats := {
"acceleration": 10.0,
"max_speed": 350.0,
"rotation_speed": 250.0
"acceleration": 15.0,
"max_speed": 400.0,
"rotation_speed": 270.0,
"laser_speed": 550.0,
"overheat": 0.0
}

var starship_bonuses := {
"acceleration": 0.0,
"max_speed": 0.0,
"rotation_speed": 0.0
"rotation_speed": 0.0,
"laser_speed": 0.0,
"overheat": 0.0
}

func earn_resource(resource_name: String, amount: int, invoice: String = "Earned"):
Expand Down
10 changes: 10 additions & 0 deletions apps/gamejam/brackeys/13/scripts/laser.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends Area2D

var movement_vector := Vector2(0, -1)

func _physics_process(delta):
var laser_speed = Global.get_starship_stat("laser_speed")
global_position += movement_vector.rotated(rotation) * laser_speed * delta

func _on_visible_on_screen_notifier_2d_screen_exited():
queue_free()
16 changes: 16 additions & 0 deletions apps/gamejam/brackeys/13/scripts/spaceship.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
class_name Spaceship extends CharacterBody2D

signal laser_shot(laser)

@onready var scope = $OmniScope

var laser_scene = preload("res://scenes/laser.tscn")

func _process(delta):
if Input.is_action_pressed("shoot"):
shoot_laser()

func _physics_process(delta):
var acceleration = Global.get_starship_stat("acceleration")
var max_speed = Global.get_starship_stat("max_speed")
Expand Down Expand Up @@ -40,3 +50,9 @@ func _physics_process(delta):
global_position.x = screen_size.x
elif global_position.x > screen_size.x:
global_position.x = 0

func shoot_laser():
var laser = laser_scene.instantiate();
laser.global_position = scope.global_position
laser.rotation = rotation
emit_signal("laser_shot", laser)
4 changes: 4 additions & 0 deletions apps/kbve/kbve.com/src/content/journal/02-19.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ tags:
The global resources will be held under a singleton that will make it easier to call anywhere within the application.
By moving all our variables into there, we can use them in both the asteroid scene and also call them in the UI.

- 06:24PM

The Omniscope will be where the weapons are fired off from and a node called `Projectiles` will hold the different bullets and lasers that get fired off.

## 2024

### Flex
Expand Down

0 comments on commit e86dddb

Please sign in to comment.