Skip to content

Commit

Permalink
Merge pull request #4048 from KBVE/patch-atomic-updating-adding-shiel…
Browse files Browse the repository at this point in the history
…d-02-21-2025-1740136525

[CI] Merge patch-atomic-updating-adding-shield-02-21-2025-1740136525 into dev
  • Loading branch information
h0lybyte authored Feb 21, 2025
2 parents 15840f1 + 488b3a9 commit 9ae0736
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 6 deletions.
2 changes: 2 additions & 0 deletions apps/gamejam/brackeys/13/scenes/asteroid.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ texture = ExtResource("1_bra2q")

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_qw1xp")

[connection signal="body_entered" from="." to="." method="_on_body_entered"]
133 changes: 130 additions & 3 deletions apps/gamejam/brackeys/13/scenes/spaceship.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[gd_scene load_steps=18 format=3 uid="uid://1s5v0llrjq3"]
[gd_scene load_steps=36 format=3 uid="uid://1s5v0llrjq3"]

[ext_resource type="Script" path="res://scripts/spaceship.gd" id="1_uejed"]
[ext_resource type="Texture2D" uid="uid://b5a5g0gqvormg" path="res://assets/frostwindz/battlecruiser.png" id="2_kvtre"]
[ext_resource type="Texture2D" uid="uid://cj16mbdine6mk" path="res://assets/frostwindz/battlecruiser_engine.png" id="3_mwphh"]
[ext_resource type="Texture2D" uid="uid://84n6013yietv" path="res://assets/frostwindz/battlecruiser_shield.png" id="4_yxx3w"]

[sub_resource type="CircleShape2D" id="CircleShape2D_s734v"]
radius = 36.0139
Expand Down Expand Up @@ -99,6 +100,126 @@ animations = [{
"speed": 5.0
}]

[sub_resource type="AtlasTexture" id="AtlasTexture_srl8d"]
atlas = ExtResource("4_yxx3w")
region = Rect2(0, 0, 128, 128)

[sub_resource type="AtlasTexture" id="AtlasTexture_miugn"]
atlas = ExtResource("4_yxx3w")
region = Rect2(128, 0, 128, 128)

[sub_resource type="AtlasTexture" id="AtlasTexture_aacb1"]
atlas = ExtResource("4_yxx3w")
region = Rect2(256, 0, 128, 128)

[sub_resource type="AtlasTexture" id="AtlasTexture_jr7jx"]
atlas = ExtResource("4_yxx3w")
region = Rect2(384, 0, 128, 128)

[sub_resource type="AtlasTexture" id="AtlasTexture_4r5u6"]
atlas = ExtResource("4_yxx3w")
region = Rect2(512, 0, 128, 128)

[sub_resource type="AtlasTexture" id="AtlasTexture_2g3gh"]
atlas = ExtResource("4_yxx3w")
region = Rect2(640, 0, 128, 128)

[sub_resource type="AtlasTexture" id="AtlasTexture_dxcam"]
atlas = ExtResource("4_yxx3w")
region = Rect2(768, 0, 128, 128)

[sub_resource type="AtlasTexture" id="AtlasTexture_s3bim"]
atlas = ExtResource("4_yxx3w")
region = Rect2(896, 0, 128, 128)

[sub_resource type="AtlasTexture" id="AtlasTexture_frb3p"]
atlas = ExtResource("4_yxx3w")
region = Rect2(1024, 0, 128, 128)

[sub_resource type="AtlasTexture" id="AtlasTexture_0ccj1"]
atlas = ExtResource("4_yxx3w")
region = Rect2(1152, 0, 128, 128)

[sub_resource type="AtlasTexture" id="AtlasTexture_kl5ol"]
atlas = ExtResource("4_yxx3w")
region = Rect2(1280, 0, 128, 128)

[sub_resource type="AtlasTexture" id="AtlasTexture_gpumw"]
atlas = ExtResource("4_yxx3w")
region = Rect2(1408, 0, 128, 128)

[sub_resource type="AtlasTexture" id="AtlasTexture_ogmnx"]
atlas = ExtResource("4_yxx3w")
region = Rect2(1536, 0, 128, 128)

[sub_resource type="AtlasTexture" id="AtlasTexture_5mjgc"]
atlas = ExtResource("4_yxx3w")
region = Rect2(1664, 0, 128, 128)

[sub_resource type="AtlasTexture" id="AtlasTexture_pcyl7"]
atlas = ExtResource("4_yxx3w")
region = Rect2(1792, 0, 128, 128)

[sub_resource type="AtlasTexture" id="AtlasTexture_4l5jx"]
atlas = ExtResource("4_yxx3w")
region = Rect2(1920, 0, 128, 128)

[sub_resource type="SpriteFrames" id="SpriteFrames_wdipm"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_srl8d")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_miugn")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_aacb1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_jr7jx")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4r5u6")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2g3gh")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_dxcam")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_s3bim")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_frb3p")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0ccj1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kl5ol")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gpumw")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ogmnx")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_5mjgc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_pcyl7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4l5jx")
}],
"loop": true,
"name": &"shield",
"speed": 5.0
}]

[node name="Spaceship" type="CharacterBody2D"]
collision_layer = 32
collision_mask = 472
Expand All @@ -117,7 +238,13 @@ shape = SubResource("CircleShape2D_s734v")
position = Vector2(0, -46)

[node name="Engine" type="AnimatedSprite2D" parent="."]
position = Vector2(0, -4)
scale = Vector2(0.804688, 0.9375)
position = Vector2(-0.125006, 1.5)
scale = Vector2(0.798828, 0.820312)
sprite_frames = SubResource("SpriteFrames_0gnt7")
animation = &"engine"

[node name="Shield" type="AnimatedSprite2D" parent="."]
position = Vector2(-8.34465e-07, 1.75)
scale = Vector2(0.84375, 0.832031)
sprite_frames = SubResource("SpriteFrames_wdipm")
animation = &"shield"
5 changes: 5 additions & 0 deletions apps/gamejam/brackeys/13/scripts/asteroid.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ func destroy():
visible = false
print("Asteroid Destroyed")
Global.emit_signal("entity_destroyed", "asteroid", get_instance_id(), {"position": global_position})

func _on_body_entered(body):
if body is Spaceship:
var starship = body
starship.activate_shield()
18 changes: 15 additions & 3 deletions apps/gamejam/brackeys/13/scripts/spaceship.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ signal laser_shot(laser)

@onready var scope = $OmniScope
@onready var engine = $Engine
@onready var shield = $Shield


var laser_scene = preload("res://scenes/laser.tscn")
Expand All @@ -14,6 +15,7 @@ func _ready():

func _process(delta):
if Input.is_action_pressed("shoot"):
shield.visible = false
shoot_laser()

func _physics_process(delta):
Expand All @@ -23,7 +25,11 @@ func _physics_process(delta):
var input_vector := Vector2(0, Input.get_axis("thrust", "reverse"))
velocity += input_vector.rotated(rotation) * acceleration
velocity = velocity.limit_length(max_speed)
engine.play("engine")

if input_vector or velocity.length() > 0.1:
engine.play("engine")
else:
engine.stop()

if Input.is_action_pressed("pan_right"):
rotate(deg_to_rad(rotation_speed*delta))
Expand All @@ -34,12 +40,12 @@ func _physics_process(delta):
var drift_direction = Vector2.RIGHT.rotated(rotation)

if Input.is_action_pressed("drift_right"):
print("E Pressed - Thrust Right Detected")
#print("E Pressed - Thrust Right Detected")
global_position = global_position.lerp(global_position + drift_direction * drift_force, delta * 5)


if Input.is_action_pressed("drift_left"):
print("Q Pressed - Thrust Left Detected")
#print("Q Pressed - Thrust Left Detected")
global_position = global_position.lerp(global_position - drift_direction * drift_force, delta * 5)

if input_vector.y == 0:
Expand All @@ -60,3 +66,9 @@ func _physics_process(delta):

func shoot_laser():
emit_signal("laser_shot", scope.global_position, rotation)


func activate_shield():
Global.emit_signal("notification_received", "shield_active", "Shield was deployed", "warning")
shield.visible = true
shield.play("shield")

0 comments on commit 9ae0736

Please sign in to comment.