Finish finishing-up of first 2D game

This commit is contained in:
Daniel Siepmann 2024-03-26 14:06:29 +01:00
parent b9281930bd
commit 7675f9f3ea
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
4 changed files with 43 additions and 3 deletions

View file

@ -1,8 +1,14 @@
[gd_scene load_steps=3 format=3 uid="uid://caxwerqlguyo7"] [gd_scene load_steps=5 format=3 uid="uid://caxwerqlguyo7"]
[ext_resource type="Script" path="res://HUD.gd" id="1_cp6uc"] [ext_resource type="Script" path="res://HUD.gd" id="1_cp6uc"]
[ext_resource type="FontFile" uid="uid://dgjjxafsbuvej" path="res://fonts/Xolonium-Regular.ttf" id="1_pbe0f"] [ext_resource type="FontFile" uid="uid://dgjjxafsbuvej" path="res://fonts/Xolonium-Regular.ttf" id="1_pbe0f"]
[sub_resource type="InputEventAction" id="InputEventAction_p01o5"]
action = &"start_game"
[sub_resource type="Shortcut" id="Shortcut_1dq22"]
events = [SubResource("InputEventAction_p01o5")]
[node name="HUD" type="CanvasLayer"] [node name="HUD" type="CanvasLayer"]
script = ExtResource("1_cp6uc") script = ExtResource("1_cp6uc")
@ -53,6 +59,7 @@ grow_horizontal = 2
grow_vertical = 0 grow_vertical = 0
theme_override_fonts/font = ExtResource("1_pbe0f") theme_override_fonts/font = ExtResource("1_pbe0f")
theme_override_font_sizes/font_size = 64 theme_override_font_sizes/font_size = 64
shortcut = SubResource("Shortcut_1dq22")
text = "Start" text = "Start"
[node name="MessageTimer" type="Timer" parent="."] [node name="MessageTimer" type="Timer" parent="."]

View file

@ -43,6 +43,8 @@ func game_over():
$ScoreTimer.stop() $ScoreTimer.stop()
$MobTimer.stop() $MobTimer.stop()
$HUD.show_game_over() $HUD.show_game_over()
$Music.stop()
$DeathSound.play()
func new_game(): func new_game():
@ -50,5 +52,6 @@ func new_game():
$Player.start($StartPosition.position) $Player.start($StartPosition.position)
$StartTimer.start() $StartTimer.start()
$HUD.update_score(score) $HUD.update_score(score)
$HUD.show_message('Get Ready')
get_tree().call_group('mobs', 'queue_free') get_tree().call_group('mobs', 'queue_free')
$HUD.show_message('Get Ready')
$Music.play()

File diff suppressed because one or more lines are too long

View file

@ -43,6 +43,11 @@ move_up={
"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":4194320,"key_label":0,"unicode":0,"echo":false,"script":null) "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":4194320,"key_label":0,"unicode":0,"echo":false,"script":null)
] ]
} }
start_game={
"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":4194309,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}
[rendering] [rendering]