From d26b61d855b02773bd1489fbd123823e72280849 Mon Sep 17 00:00:00 2001 From: winniewk Date: Mon, 19 Aug 2024 21:18:33 -0400 Subject: [PATCH] Updated game reset to happen after defeat anim --- .godot/editor/editor_layout.cfg | 2 +- .godot/editor/script_editor_cache.cfg | 8 ++++---- scenes/game.tscn | 1 + scripts/characterBody.gd | 1 - scripts/gamecontroller.gd | 3 +++ 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.godot/editor/editor_layout.cfg b/.godot/editor/editor_layout.cfg index c6d834a..0c58482 100644 --- a/.godot/editor/editor_layout.cfg +++ b/.godot/editor/editor_layout.cfg @@ -32,7 +32,7 @@ current_scene="res://scenes/game.tscn" center_split_offset=-272 selected_default_debugger_tab_idx=0 selected_main_editor_idx=2 -selected_bottom_panel_item=0 +selected_bottom_panel_item=1 [ScriptEditor] diff --git a/.godot/editor/script_editor_cache.cfg b/.godot/editor/script_editor_cache.cfg index 2197eb4..5ca5892 100644 --- a/.godot/editor/script_editor_cache.cfg +++ b/.godot/editor/script_editor_cache.cfg @@ -7,7 +7,7 @@ state={ "folded_lines": Array[int]([]), "h_scroll_position": 0, "row": 39, -"scroll_position": 17.0, +"scroll_position": 29.0, "selection": false, "syntax_highlighter": "GDScript" } @@ -59,11 +59,11 @@ state={ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 17, +"column": 16, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 115, -"scroll_position": 101.0, +"row": 29, +"scroll_position": 21.0, "selection": false, "syntax_highlighter": "GDScript" } diff --git a/scenes/game.tscn b/scenes/game.tscn index 37f15bb..caae808 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -611,5 +611,6 @@ position = Vector2(559, 84) [node name="Control" parent="CanvasLayer" instance=ExtResource("11_k7pka")] [connection signal="timeout" from="GameController/Timer" to="GameController" method="resetWorld"] +[connection signal="defeatAnimComplete" from="CharacterBody2D" to="GameController" method="resetWorld"] [connection signal="areatrigger" from="AreaTrigger" to="GameController" method="_on_area_2d_areatrigger"] [connection signal="body_entered" from="AreaTrigger" to="AreaTrigger" method="_on_body_entered"] diff --git a/scripts/characterBody.gd b/scripts/characterBody.gd index 9405ab7..470b419 100644 --- a/scripts/characterBody.gd +++ b/scripts/characterBody.gd @@ -28,7 +28,6 @@ var bullet = preload("res://scenes/bullet.tscn") var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") func defeated(): - print("character body player defeated") playPlayerAnimation("death") living = false diff --git a/scripts/gamecontroller.gd b/scripts/gamecontroller.gd index 61e3e6a..8f34d05 100644 --- a/scripts/gamecontroller.gd +++ b/scripts/gamecontroller.gd @@ -45,3 +45,6 @@ func _on_area_2d_coin_collected(): func playerDamage(): GameManager.playerDamage() ui.healthUpdate(GameManager.player.currentHealth) + +func resetGame(): + timer.start()