godot-shooter / commit
Adding a debug signal to the game: space is right now linked to winning the game.
HUD.gd | 3 +++ World.gd | 5 ++++- World.tscn | 1 + project.godot | 5 +++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/HUD.gd b/HUD.gd index a6cbdad..22586fc 100644 --- a/HUD.gd +++ b/HUD.gd @@ -5,6 +5,7 @@ export var score = 0 export var level = 1 export var objective = "1/17" signal paused +signal debug_signal onready var label = $CanvasLayer/MessageLabel onready var animation_player = $AnimationPlayer @@ -24,6 +25,8 @@ func _process(_delta: float) -> void: # restart() if Input.is_action_just_pressed("restart"): restart() + if Input.is_action_just_pressed("debug_action"): + emit_signal("debug_signal") func restart(): var _error = get_tree().reload_current_scene() diff --git a/World.gd b/World.gd index a17ea76..e7a62ae 100644 --- a/World.gd +++ b/World.gd @@ -199,6 +199,9 @@ func _on_Player_shield_changed(shield_active: bool) -> void: var message = "Shield Activated" if shield_active else "Shield Lost!" $UI/HUD.show_message(message) - func _on_HUD_paused() -> void: pause() + +func _on_HUD_debug_signal() -> void: + completed_objectives = 5 + pass # Replace with function body. diff --git a/World.tscn b/World.tscn index a408a99..8d682d0 100644 --- a/World.tscn +++ b/World.tscn @@ -141,6 +141,7 @@ round_precision = 13 antialiased = true [connection signal="body_entered" from="Destination" to="." method="_on_Destination_body_entered"] +[connection signal="debug_signal" from="UI/HUD" to="." method="_on_HUD_debug_signal"] [connection signal="paused" from="UI/HUD" to="." method="_on_HUD_paused"] [connection signal="pressed" from="UI/PauseMenu/Panel/VBoxContainer/Button" to="." method="_on_Button_pressed"] [connection signal="pressed" from="UI/GameFinishedMenu/Panel/VBoxContainer/Button" to="." method="_on_Game_over_button_pressed"] diff --git a/project.godot b/project.godot index a402a8e..4f43525 100644 --- a/project.godot +++ b/project.godot @@ -108,6 +108,11 @@ pause={ "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":80,"physical_scancode":0,"unicode":0,"echo":false,"script":null) ] } +debug_action={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} [network]