From 149ac083d47f56f634dcbc323b4344c654b72743 Mon Sep 17 00:00:00 2001 From: OddlyTimbot Date: Mon, 19 Aug 2024 21:11:13 -0400 Subject: [PATCH] game manager and data objects --- ...lding-55e79923beab518e5d99fd7b0ed71005.cfg | 3 + ...state-e196a632ea77e9a0d8baa608f164a4d2.cfg | 2 +- ...state-6d8e6ff1e6f20a36e0402d27c623c86c.cfg | 2 +- ...state-b6bd7a241034177d7fe082a7597ba8ea.cfg | 2 +- ...lding-0296addfc5e73945558bee2549c7ec08.cfg | 3 + ...state-96b2131180b71dd158e52c5527d22dd4.cfg | 2 +- ...state-65637dc57c83dac3d15ec1cb22439bd7.cfg | 2 +- .godot/editor/create_recent.Node | 11 +- .godot/editor/create_recent.Resource | 1 + .godot/editor/editor_layout.cfg | 12 +- .godot/editor/favorites.Resource | 0 .godot/editor/filesystem_cache8 | 81 ++++---- .godot/editor/filesystem_update4 | 7 +- ...state-c2a7af834e91ff64325daddf58e45dc0.cfg | 6 +- ...state-cc2f727180cd42d9c13434cb55b1ce69.cfg | 2 +- ...lding-def9a820d1604674863d8d05fbe3e5e5.cfg | 3 + .godot/editor/project_metadata.cfg | 10 +- .godot/editor/recent_dirs | 5 +- .godot/editor/script_editor_cache.cfg | 72 +++++-- ...lding-dc3efe8fa305bac755dbc3644b25d397.cfg | 3 + ...lding-3b8d530734b8023ccf565168363a2129.cfg | 3 + ...state-9211dc52ac9df169ba4fe77cbc1dc833.cfg | 175 ++++++++++++++++++ ...lding-9211dc52ac9df169ba4fe77cbc1dc833.cfg | 5 + .godot/global_script_class_cache.cfg | 20 +- .godot/uid_cache.bin | Bin 969 -> 1106 bytes project.godot | 4 + scenes/character.tscn | 2 + scenes/game.tscn | 20 +- scenes/ui.tscn | 38 ++++ scripts/CharacterBody2D.gd | 25 ++- scripts/GameManager.gd | 23 +++ scripts/badguy.gd | 7 +- scripts/coin.gd | 16 +- scripts/gamecontroller.gd | 42 +++-- scripts/resources/character_stats.gd | 5 + scripts/resources/player_stats.tres | 9 + scripts/resources/slime_stats.tres | 9 + scripts/ui.gd | 12 ++ 38 files changed, 522 insertions(+), 122 deletions(-) create mode 100644 .godot/editor/GameManager.gd-folding-55e79923beab518e5d99fd7b0ed71005.cfg create mode 100644 .godot/editor/character_stats.gd-folding-0296addfc5e73945558bee2549c7ec08.cfg create mode 100644 .godot/editor/create_recent.Resource create mode 100644 .godot/editor/favorites.Resource create mode 100644 .godot/editor/player_stats.tres-folding-def9a820d1604674863d8d05fbe3e5e5.cfg create mode 100644 .godot/editor/slime_stats.tres-folding-dc3efe8fa305bac755dbc3644b25d397.cfg create mode 100644 .godot/editor/ui.gd-folding-3b8d530734b8023ccf565168363a2129.cfg create mode 100644 .godot/editor/ui.tscn-editstate-9211dc52ac9df169ba4fe77cbc1dc833.cfg create mode 100644 .godot/editor/ui.tscn-folding-9211dc52ac9df169ba4fe77cbc1dc833.cfg create mode 100644 scenes/ui.tscn create mode 100644 scripts/GameManager.gd create mode 100644 scripts/resources/character_stats.gd create mode 100644 scripts/resources/player_stats.tres create mode 100644 scripts/resources/slime_stats.tres create mode 100644 scripts/ui.gd diff --git a/.godot/editor/GameManager.gd-folding-55e79923beab518e5d99fd7b0ed71005.cfg b/.godot/editor/GameManager.gd-folding-55e79923beab518e5d99fd7b0ed71005.cfg new file mode 100644 index 0000000..e860dd4 --- /dev/null +++ b/.godot/editor/GameManager.gd-folding-55e79923beab518e5d99fd7b0ed71005.cfg @@ -0,0 +1,3 @@ +[folding] + +sections_unfolded=PackedStringArray() diff --git a/.godot/editor/badguy.tscn-editstate-e196a632ea77e9a0d8baa608f164a4d2.cfg b/.godot/editor/badguy.tscn-editstate-e196a632ea77e9a0d8baa608f164a4d2.cfg index 3854d59..48f9705 100644 --- a/.godot/editor/badguy.tscn-editstate-e196a632ea77e9a0d8baa608f164a4d2.cfg +++ b/.godot/editor/badguy.tscn-editstate-e196a632ea77e9a0d8baa608f164a4d2.cfg @@ -172,4 +172,4 @@ Anim={ "zfar": 4000.01, "znear": 0.05 } -selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/CharacterBody2D")]) +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Control/VBoxContainer/HBoxContainer/MarginContainer2/Coins")]) diff --git a/.godot/editor/bullet.tscn-editstate-6d8e6ff1e6f20a36e0402d27c623c86c.cfg b/.godot/editor/bullet.tscn-editstate-6d8e6ff1e6f20a36e0402d27c623c86c.cfg index e03ba01..473ea39 100644 --- a/.godot/editor/bullet.tscn-editstate-6d8e6ff1e6f20a36e0402d27c623c86c.cfg +++ b/.godot/editor/bullet.tscn-editstate-6d8e6ff1e6f20a36e0402d27c623c86c.cfg @@ -172,4 +172,4 @@ Anim={ "zfar": 4000.01, "znear": 0.05 } -selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/CharacterBody2D")]) +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Control/VBoxContainer/HBoxContainer/MarginContainer2/Coins")]) diff --git a/.godot/editor/character.tscn-editstate-b6bd7a241034177d7fe082a7597ba8ea.cfg b/.godot/editor/character.tscn-editstate-b6bd7a241034177d7fe082a7597ba8ea.cfg index 066d5d8..47f484a 100644 --- a/.godot/editor/character.tscn-editstate-b6bd7a241034177d7fe082a7597ba8ea.cfg +++ b/.godot/editor/character.tscn-editstate-b6bd7a241034177d7fe082a7597ba8ea.cfg @@ -172,4 +172,4 @@ Anim={ "zfar": 4000.01, "znear": 0.05 } -selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/CharacterBody2D")]) +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Control/VBoxContainer/HBoxContainer/MarginContainer2/Coins")]) diff --git a/.godot/editor/character_stats.gd-folding-0296addfc5e73945558bee2549c7ec08.cfg b/.godot/editor/character_stats.gd-folding-0296addfc5e73945558bee2549c7ec08.cfg new file mode 100644 index 0000000..e860dd4 --- /dev/null +++ b/.godot/editor/character_stats.gd-folding-0296addfc5e73945558bee2549c7ec08.cfg @@ -0,0 +1,3 @@ +[folding] + +sections_unfolded=PackedStringArray() diff --git a/.godot/editor/coin.tscn-editstate-96b2131180b71dd158e52c5527d22dd4.cfg b/.godot/editor/coin.tscn-editstate-96b2131180b71dd158e52c5527d22dd4.cfg index 3053234..e6409c8 100644 --- a/.godot/editor/coin.tscn-editstate-96b2131180b71dd158e52c5527d22dd4.cfg +++ b/.godot/editor/coin.tscn-editstate-96b2131180b71dd158e52c5527d22dd4.cfg @@ -172,4 +172,4 @@ Anim={ "zfar": 4000.01, "znear": 0.05 } -selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/CharacterBody2D")]) +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Control/VBoxContainer/HBoxContainer/MarginContainer2/Coins")]) diff --git a/.godot/editor/crate.tscn-editstate-65637dc57c83dac3d15ec1cb22439bd7.cfg b/.godot/editor/crate.tscn-editstate-65637dc57c83dac3d15ec1cb22439bd7.cfg index 935376b..2fd6f29 100644 --- a/.godot/editor/crate.tscn-editstate-65637dc57c83dac3d15ec1cb22439bd7.cfg +++ b/.godot/editor/crate.tscn-editstate-65637dc57c83dac3d15ec1cb22439bd7.cfg @@ -172,4 +172,4 @@ Anim={ "zfar": 4000.01, "znear": 0.05 } -selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/CharacterBody2D")]) +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Control/VBoxContainer/HBoxContainer/MarginContainer2/Coins")]) diff --git a/.godot/editor/create_recent.Node b/.godot/editor/create_recent.Node index 395c938..d37d27f 100644 --- a/.godot/editor/create_recent.Node +++ b/.godot/editor/create_recent.Node @@ -1,14 +1,15 @@ +CanvasLayer +MarginContainer +Label +HBoxContainer +VBoxContainer +Node Timer RayCast2D CollisionShape2D AnimatedSprite2D Area2D -Node Sprite2D ParallaxLayer ParallaxBackground Node2D -AnimationPlayer -AnimatableBody2D -Camera2D -TileMap diff --git a/.godot/editor/create_recent.Resource b/.godot/editor/create_recent.Resource new file mode 100644 index 0000000..27df1c7 --- /dev/null +++ b/.godot/editor/create_recent.Resource @@ -0,0 +1 @@ +Character diff --git a/.godot/editor/editor_layout.cfg b/.godot/editor/editor_layout.cfg index ab58dfc..7a07836 100644 --- a/.godot/editor/editor_layout.cfg +++ b/.godot/editor/editor_layout.cfg @@ -19,16 +19,16 @@ dock_filesystem_split=0 dock_filesystem_display_mode=0 dock_filesystem_file_sort=0 dock_filesystem_file_list_display_mode=1 -dock_filesystem_selected_paths=PackedStringArray("res://graphics/Player Death/") -dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://", "res://scripts/", "res://scenes/", "res://graphics/", "res://graphics/Player Death/") +dock_filesystem_selected_paths=PackedStringArray("res://scenes/ui.tscn") +dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://", "res://scripts/", "res://scripts/resources/", "res://scenes/", "res://graphics/") dock_3="Scene,Import" dock_4="FileSystem" dock_5="Inspector,Node,History" [EditorNode] -open_scenes=PackedStringArray("res://scenes/game.tscn", "res://scenes/character.tscn", "res://scenes/bullet.tscn", "res://scenes/crate.tscn", "res://scenes/platform.tscn", "res://scenes/coin.tscn", "res://scenes/badguy.tscn") -current_scene="res://scenes/game.tscn" +open_scenes=PackedStringArray("res://scenes/game.tscn", "res://scenes/character.tscn", "res://scenes/bullet.tscn", "res://scenes/crate.tscn", "res://scenes/platform.tscn", "res://scenes/coin.tscn", "res://scenes/badguy.tscn", "res://scenes/ui.tscn") +current_scene="res://scenes/ui.tscn" center_split_offset=-247 selected_default_debugger_tab_idx=0 selected_main_editor_idx=2 @@ -36,8 +36,8 @@ selected_bottom_panel_item=0 [ScriptEditor] -open_scripts=["res://scripts/badguy.gd", "res://scripts/bullet.gd", "res://scripts/CharacterBody2D.gd", "res://scripts/coin.gd", "res://scripts/gamecontroller.gd", "res://scripts/Trigger.gd"] -selected_script="res://scripts/gamecontroller.gd" +open_scripts=["res://scripts/badguy.gd", "res://scripts/bullet.gd", "res://scripts/CharacterBody2D.gd", "res://scripts/resources/character_stats.gd", "res://scripts/coin.gd", "res://scripts/gamecontroller.gd", "res://scripts/GameManager.gd", "res://scripts/Trigger.gd", "res://scripts/ui.gd"] +selected_script="res://scripts/ui.gd" open_help=[] script_split_offset=70 list_split_offset=0 diff --git a/.godot/editor/favorites.Resource b/.godot/editor/favorites.Resource new file mode 100644 index 0000000..e69de29 diff --git a/.godot/editor/filesystem_cache8 b/.godot/editor/filesystem_cache8 index 9ef0b16..a2d4a3f 100644 --- a/.godot/editor/filesystem_cache8 +++ b/.godot/editor/filesystem_cache8 @@ -1,41 +1,42 @@ ea4bc82a6ad023ab7ee23ee620429895 -::res://::1723499748 -icon.svg::CompressedTexture2D::9114977118871582245::1723499516::1723499516::1::::<><>:: -::res://graphics/::1723509991 -bullet.png::CompressedTexture2D::4834894094516681527::1723499516::1723499516::1::::<><>:: -Terrain (32x32).png::CompressedTexture2D::8707534964839485024::1723499516::1723499516::1::::<><>:: -::res://graphics/background/::1723501213 -Additional Sky.png::CompressedTexture2D::6453351609810348480::1723501213::1723501213::1::::<><>:: -Additional Water.png::CompressedTexture2D::4106022825291545778::1723501213::1723501213::1::::<><>:: -BG Image.png::CompressedTexture2D::237374342318087251::1723501213::1723501213::1::::<><>:: -::res://graphics/enemies/::1723506305 -slime_purple.png::CompressedTexture2D::4414376887898401849::1723506305::1723506305::1::::<><>:: -::res://graphics/items/::1723499516 -cannister.png::CompressedTexture2D::7418095402531000042::1723499516::1723499516::1::::<><>:: -::res://graphics/pickups/::1723502323 -coin.png::CompressedTexture2D::9033362620640926021::1723502323::1723502323::1::::<><>:: -::res://graphics/Player Death/::1723509999 -Player Death 64x64.png::CompressedTexture2D::116608705279953946::1723509999::1723509999::1::::<><>:: -::res://graphics/Player Idle/::1723499516 -Player Idle 48x48.png::CompressedTexture2D::6544563428604246579::1723499516::1723499516::1::::<><>:: -::res://graphics/Player Jump/::1723499516 -player jump 48x48.png::CompressedTexture2D::1627608568707791839::1723499516::1723499516::1::::<><>:: -::res://graphics/Player Land/::1723499516 -player land 48x48.png::CompressedTexture2D::3499637713582873633::1723499516::1723499516::1::::<><>:: -::res://graphics/Player Run/::1723499516 -player run 48x48.png::CompressedTexture2D::1502492849971408816::1723499516::1723499516::1::::<><>:: -::res://scenes/::1723509898 -badguy.tscn::PackedScene::488149358851198558::1723509898::0::1::::<><>::uid://b35me3ux1dl8t::::res://graphics/enemies/slime_purple.png<>res://scripts/badguy.gd -bullet.tscn::PackedScene::6880909734590904373::1723509898::0::1::::<><>::res://scripts/bullet.gd<>uid://ca5b88ipe5ks2::::res://graphics/bullet.png -character.tscn::PackedScene::451838158579532324::1723509898::0::1::::<><>::res://scripts/CharacterBody2D.gd<>uid://c0iiaebonyhh0::::res://graphics/Player Idle/Player Idle 48x48.png<>uid://xgoqfqmvorcx::::res://graphics/Player Jump/player jump 48x48.png<>uid://vn23qn3f0dvc::::res://graphics/Player Run/player run 48x48.png -coin.tscn::PackedScene::6452089725107733211::1723509898::0::1::::<><>::res://scripts/coin.gd<>uid://d1x3fr6xxt4mr::::res://graphics/pickups/coin.png -crate.tscn::PackedScene::41931541512830250::1723509898::0::1::::<><>::uid://ddxm7hj323fta::::res://graphics/items/cannister.png -game.tscn::PackedScene::1738196330916037717::1723509898::0::1::::<><>::res://scripts/gamecontroller.gd<>uid://go4yc8hfo1gq::::res://scenes/character.tscn<>uid://dwb83f7uoweuy::::res://graphics/Terrain (32x32).png<>res://scripts/Trigger.gd<>uid://dm8rx8b2mh3p::::res://graphics/background/BG Image.png<>uid://cx7b01o887hk7::::res://graphics/background/Additional Sky.png<>uid://byq8ujatf55a1::::res://graphics/background/Additional Water.png<>uid://ukuu7p7vhlq::::res://scenes/crate.tscn<>uid://ci10o5e0xpxm8::::res://scenes/platform.tscn<>uid://cx6o8fh0fj8kl::::res://scenes/coin.tscn<>uid://g7p0pn145hpe::::res://scenes/badguy.tscn -platform.tscn::PackedScene::5389570447076805405::1723509898::0::1::::<><>:: -::res://scripts/::1723509883 -badguy.gd::GDScript::-1::1723509883::0::1::::<>Area2D<>:: -bullet.gd::GDScript::-1::1723499516::0::1::::<>Area2D<>:: -CharacterBody2D.gd::GDScript::-1::1723499516::0::1::::<>CharacterBody2D<>:: -coin.gd::GDScript::-1::1723504932::0::1::::<>Area2D<>:: -gamecontroller.gd::GDScript::-1::1723509526::0::1::::<>Node<>:: -Trigger.gd::GDScript::-1::1723499516::0::1::::<>Area2D<>:: +::res://::1724106263 +icon.svg::CompressedTexture2D::9114977118871582245::1724102900::1724102900::1::::<><>:: +::res://graphics/::1724102900 +bullet.png::CompressedTexture2D::4834894094516681527::1724102900::1724102900::1::::<><>:: +Terrain (32x32).png::CompressedTexture2D::8707534964839485024::1724102900::1724102900::1::::<><>:: +::res://graphics/background/::1724102900 +Additional Sky.png::CompressedTexture2D::6453351609810348480::1724102900::1724102900::1::::<><>:: +Additional Water.png::CompressedTexture2D::4106022825291545778::1724102900::1724102900::1::::<><>:: +BG Image.png::CompressedTexture2D::237374342318087251::1724102900::1724102900::1::::<><>:: +::res://graphics/enemies/::1724102900 +slime_purple.png::CompressedTexture2D::4414376887898401849::1724102900::1724102900::1::::<><>:: +::res://graphics/items/::1724102900 +cannister.png::CompressedTexture2D::7418095402531000042::1724102900::1724102900::1::::<><>:: +::res://graphics/pickups/::1724102900 +coin.png::CompressedTexture2D::9033362620640926021::1724102900::1724102900::1::::<><>:: +::res://graphics/Player Death/::1724102900 +Player Death 64x64.png::CompressedTexture2D::116608705279953946::1724102900::1724102900::1::::<><>:: +::res://graphics/Player Idle/::1724102900 +Player Idle 48x48.png::CompressedTexture2D::6544563428604246579::1724102900::1724102900::1::::<><>:: +::res://graphics/Player Jump/::1724102900 +player jump 48x48.png::CompressedTexture2D::1627608568707791839::1724102900::1724102900::1::::<><>:: +::res://graphics/Player Land/::1724102900 +player land 48x48.png::CompressedTexture2D::3499637713582873633::1724102900::1724102900::1::::<><>:: +::res://graphics/Player Run/::1724102900 +player run 48x48.png::CompressedTexture2D::1502492849971408816::1724102900::1724102900::1::::<><>:: +::res://scenes/::1724108421 +badguy.tscn::PackedScene::488149358851198558::1724108421::0::1::::<><>::uid://b35me3ux1dl8t::::res://graphics/enemies/slime_purple.png<>res://scripts/badguy.gd +bullet.tscn::PackedScene::6880909734590904373::1724108421::0::1::::<><>::res://scripts/bullet.gd<>uid://ca5b88ipe5ks2::::res://graphics/bullet.png +character.tscn::PackedScene::451838158579532324::1724108421::0::1::::<><>::res://scripts/CharacterBody2D.gd<>uid://bwqr703yjxqw::::res://graphics/Player Death/Player Death 64x64.png<>uid://c0iiaebonyhh0::::res://graphics/Player Idle/Player Idle 48x48.png<>uid://xgoqfqmvorcx::::res://graphics/Player Jump/player jump 48x48.png<>uid://vn23qn3f0dvc::::res://graphics/Player Run/player run 48x48.png +coin.tscn::PackedScene::6452089725107733211::1724108421::0::1::::<><>::res://scripts/coin.gd<>uid://d1x3fr6xxt4mr::::res://graphics/pickups/coin.png +crate.tscn::PackedScene::41931541512830250::1724108421::0::1::::<><>::uid://ddxm7hj323fta::::res://graphics/items/cannister.png +game.tscn::PackedScene::1738196330916037717::1724108421::0::1::::<><>::res://scripts/gamecontroller.gd<>uid://go4yc8hfo1gq::::res://scenes/character.tscn<>uid://dwb83f7uoweuy::::res://graphics/Terrain (32x32).png<>res://scripts/Trigger.gd<>uid://dm8rx8b2mh3p::::res://graphics/background/BG Image.png<>uid://cx7b01o887hk7::::res://graphics/background/Additional Sky.png<>uid://byq8ujatf55a1::::res://graphics/background/Additional Water.png<>uid://ukuu7p7vhlq::::res://scenes/crate.tscn<>uid://ci10o5e0xpxm8::::res://scenes/platform.tscn<>uid://cx6o8fh0fj8kl::::res://scenes/coin.tscn<>uid://g7p0pn145hpe::::res://scenes/badguy.tscn +platform.tscn::PackedScene::5389570447076805405::1724108421::0::1::::<><>:: +::res://scripts/::1724108421 +badguy.gd::GDScript::-1::1724102900::0::1::::<>Area2D<>:: +bullet.gd::GDScript::-1::1724102900::0::1::::<>Area2D<>:: +CharacterBody2D.gd::GDScript::-1::1724102900::0::1::::<>CharacterBody2D<>:: +coin.gd::GDScript::-1::1724107621::0::1::::Coin<>Area2D<>:: +gamecontroller.gd::GDScript::-1::1724108299::0::1::::<>Node<>:: +GameManager.gd::GDScript::-1::1724108421::0::1::::<>Node<>:: +Trigger.gd::GDScript::-1::1724102900::0::1::::<>Area2D<>:: diff --git a/.godot/editor/filesystem_update4 b/.godot/editor/filesystem_update4 index a7389ed..32fbca4 100644 --- a/.godot/editor/filesystem_update4 +++ b/.godot/editor/filesystem_update4 @@ -4,8 +4,13 @@ res://scenes/bullet.tscn res://scenes/crate.tscn res://scenes/platform.tscn res://scenes/coin.tscn +res://scenes/badguy.tscn +res://scripts/GameManager.gd res://scripts/coin.gd res://scripts/gamecontroller.gd -res://scenes/badguy.tscn +res://scripts/resources/character_stats.gd +res://scripts/resources/slime_stats.tres res://scripts/badguy.gd res://scripts/CharacterBody2D.gd +res://scenes/ui.tscn +res://scripts/ui.gd diff --git a/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg b/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg index 9295764..1a26a1d 100644 --- a/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg +++ b/.godot/editor/game.tscn-editstate-c2a7af834e91ff64325daddf58e45dc0.cfg @@ -8,7 +8,7 @@ Anim={ "grid_snap_active": false, "grid_step": Vector2(8, 8), "grid_visibility": 1, -"ofs": Vector2(-206.898, -321.44), +"ofs": Vector2(-78.8771, -80.2392), "primary_grid_step": Vector2i(8, 8), "show_edit_locks": true, "show_guides": true, @@ -32,7 +32,7 @@ Anim={ "snap_rotation_step": 0.261799, "snap_scale": false, "snap_scale_step": 0.1, -"zoom": 1.18921 +"zoom": 1.49831 } 3D={ "fov": 70.01, @@ -172,4 +172,4 @@ Anim={ "zfar": 4000.01, "znear": 0.05 } -selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/CharacterBody2D")]) +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Control/VBoxContainer/HBoxContainer/MarginContainer2/Coins")]) diff --git a/.godot/editor/platform.tscn-editstate-cc2f727180cd42d9c13434cb55b1ce69.cfg b/.godot/editor/platform.tscn-editstate-cc2f727180cd42d9c13434cb55b1ce69.cfg index eff236d..e4555bd 100644 --- a/.godot/editor/platform.tscn-editstate-cc2f727180cd42d9c13434cb55b1ce69.cfg +++ b/.godot/editor/platform.tscn-editstate-cc2f727180cd42d9c13434cb55b1ce69.cfg @@ -172,4 +172,4 @@ Anim={ "zfar": 4000.01, "znear": 0.05 } -selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Game/CharacterBody2D")]) +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Control/VBoxContainer/HBoxContainer/MarginContainer2/Coins")]) diff --git a/.godot/editor/player_stats.tres-folding-def9a820d1604674863d8d05fbe3e5e5.cfg b/.godot/editor/player_stats.tres-folding-def9a820d1604674863d8d05fbe3e5e5.cfg new file mode 100644 index 0000000..e860dd4 --- /dev/null +++ b/.godot/editor/player_stats.tres-folding-def9a820d1604674863d8d05fbe3e5e5.cfg @@ -0,0 +1,3 @@ +[folding] + +sections_unfolded=PackedStringArray() diff --git a/.godot/editor/project_metadata.cfg b/.godot/editor/project_metadata.cfg index 0b9e863..3b3c6e9 100644 --- a/.godot/editor/project_metadata.cfg +++ b/.godot/editor/project_metadata.cfg @@ -14,8 +14,8 @@ run_debug_collisions=true [recent_files] -scenes=["res://scenes/badguy.tscn", "res://scenes/coin.tscn", "res://scenes/platform.tscn", "res://scenes/crate.tscn", "res://scenes/bullet.tscn", "res://scenes/character.tscn", "res://scenes/game.tscn"] -scripts=["res://scripts/badguy.gd", "res://scripts/coin.gd", "res://scripts/Trigger.gd", "res://scripts/bullet.gd", "res://scripts/CharacterBody2D.gd", "res://scripts/gamecontroller.gd"] +scenes=["res://scenes/ui.tscn", "res://scenes/badguy.tscn", "res://scenes/coin.tscn", "res://scenes/platform.tscn", "res://scenes/crate.tscn", "res://scenes/bullet.tscn", "res://scenes/character.tscn", "res://scenes/game.tscn"] +scripts=["res://scripts/ui.gd", "res://scripts/resources/character_stats.gd", "res://scripts/GameManager.gd", "res://scripts/badguy.gd", "res://scripts/coin.gd", "res://scripts/Trigger.gd", "res://scripts/bullet.gd", "res://scripts/CharacterBody2D.gd", "res://scripts/gamecontroller.gd"] [linked_properties] @@ -37,6 +37,12 @@ ParallaxBackground:scroll_base_scale=true ParallaxBackground:scale=true ParallaxLayer:motion_scale=true ParallaxLayer:scale=true +Control:scale=true +VBoxContainer:scale=true +Label:scale=true +HBoxContainer:scale=true +MarginContainer:scale=true +CanvasLayer:scale=true [dialog_bounds] diff --git a/.godot/editor/recent_dirs b/.godot/editor/recent_dirs index 07dc086..5df47db 100644 --- a/.godot/editor/recent_dirs +++ b/.godot/editor/recent_dirs @@ -1,7 +1,8 @@ -res://graphics/Player Death res://scripts -res://graphics/enemies res://scenes +res://scripts/resources/ +res://graphics/Player Death +res://graphics/enemies res://graphics/pickups res://graphics/Player Jump res://graphics/Player Run diff --git a/.godot/editor/script_editor_cache.cfg b/.godot/editor/script_editor_cache.cfg index 6fa199e..755ebb4 100644 --- a/.godot/editor/script_editor_cache.cfg +++ b/.godot/editor/script_editor_cache.cfg @@ -3,11 +3,11 @@ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 14, +"column": 42, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 40, -"scroll_position": 28.0, +"row": 54, +"scroll_position": 43.0, "selection": false, "syntax_highlighter": "GDScript" } @@ -17,16 +17,12 @@ state={ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 0, +"column": 27, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 26, -"scroll_position": 20.0, -"selection": true, -"selection_from_column": 0, -"selection_from_line": 26, -"selection_to_column": 15, -"selection_to_line": 29, +"row": 81, +"scroll_position": 75.0, +"selection": false, "syntax_highlighter": "GDScript" } @@ -63,11 +59,11 @@ state={ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 14, +"column": 16, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 18, -"scroll_position": 1.0, +"row": 0, +"scroll_position": 0.0, "selection": false, "syntax_highlighter": "GDScript" } @@ -77,11 +73,53 @@ state={ state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 31, +"column": 18, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 38, -"scroll_position": 24.0, +"row": 0, +"scroll_position": 0.0, +"selection": false, +"syntax_highlighter": "GDScript" +} + +[res://scripts/GameManager.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 51, +"folded_lines": Array[int]([]), +"h_scroll_position": 0, +"row": 16, +"scroll_position": 0.0, +"selection": false, +"syntax_highlighter": "GDScript" +} + +[res://scripts/resources/character_stats.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 29, +"folded_lines": Array[int]([]), +"h_scroll_position": 0, +"row": 4, +"scroll_position": 0.0, +"selection": false, +"syntax_highlighter": "GDScript" +} + +[res://scripts/ui.gd] + +state={ +"bookmarks": PackedInt32Array(), +"breakpoints": PackedInt32Array(), +"column": 39, +"folded_lines": Array[int]([]), +"h_scroll_position": 0, +"row": 6, +"scroll_position": 0.0, "selection": false, "syntax_highlighter": "GDScript" } diff --git a/.godot/editor/slime_stats.tres-folding-dc3efe8fa305bac755dbc3644b25d397.cfg b/.godot/editor/slime_stats.tres-folding-dc3efe8fa305bac755dbc3644b25d397.cfg new file mode 100644 index 0000000..e860dd4 --- /dev/null +++ b/.godot/editor/slime_stats.tres-folding-dc3efe8fa305bac755dbc3644b25d397.cfg @@ -0,0 +1,3 @@ +[folding] + +sections_unfolded=PackedStringArray() diff --git a/.godot/editor/ui.gd-folding-3b8d530734b8023ccf565168363a2129.cfg b/.godot/editor/ui.gd-folding-3b8d530734b8023ccf565168363a2129.cfg new file mode 100644 index 0000000..e860dd4 --- /dev/null +++ b/.godot/editor/ui.gd-folding-3b8d530734b8023ccf565168363a2129.cfg @@ -0,0 +1,3 @@ +[folding] + +sections_unfolded=PackedStringArray() diff --git a/.godot/editor/ui.tscn-editstate-9211dc52ac9df169ba4fe77cbc1dc833.cfg b/.godot/editor/ui.tscn-editstate-9211dc52ac9df169ba4fe77cbc1dc833.cfg new file mode 100644 index 0000000..ad1b251 --- /dev/null +++ b/.godot/editor/ui.tscn-editstate-9211dc52ac9df169ba4fe77cbc1dc833.cfg @@ -0,0 +1,175 @@ +[editor_states] + +Anim={ +"visible": false +} +2D={ +"grid_offset": Vector2(0, 0), +"grid_snap_active": false, +"grid_step": Vector2(8, 8), +"grid_visibility": 1, +"ofs": Vector2(-165, -110), +"primary_grid_step": Vector2i(8, 8), +"show_edit_locks": true, +"show_guides": true, +"show_helpers": false, +"show_origin": true, +"show_rulers": true, +"show_transformation_gizmos": true, +"show_viewport": true, +"show_zoom_control": true, +"smart_snap_active": false, +"snap_guides": true, +"snap_node_anchors": true, +"snap_node_center": true, +"snap_node_parent": true, +"snap_node_sides": true, +"snap_other_nodes": true, +"snap_pixel": true, +"snap_relative": false, +"snap_rotation": false, +"snap_rotation_offset": 0.0, +"snap_rotation_step": 0.261799, +"snap_scale": false, +"snap_scale_step": 0.1, +"zoom": 1.0 +} +3D={ +"fov": 70.01, +"gizmos_status": { +"AudioListener3D": 0, +"AudioStreamPlayer3D": 0, +"CPUParticles3D": 0, +"CSGShape3D": 0, +"Camera3D": 0, +"CollisionObject3D": 0, +"CollisionPolygon3D": 0, +"CollisionShape3D": 0, +"Decal": 0, +"FogVolume": 0, +"GPUParticles3D": 0, +"GPUParticlesCollision3D": 0, +"Joint3D": 0, +"Light3D": 0, +"LightmapGI": 0, +"LightmapProbe": 0, +"Marker3D": 0, +"NavigationLink3D": 0, +"NavigationRegion3D": 0, +"OccluderInstance3D": 0, +"Path3D": 0, +"PhysicalBone3D": 0, +"RayCast3D": 0, +"ReflectionProbe": 0, +"ShapeCast3D": 0, +"Skeleton3D": 0, +"SoftBody3D": 0, +"SpringArm3D": 0, +"VehicleWheel3D": 0, +"VisibleOnScreenNotifier3D": 0, +"VoxelGI": 0 +}, +"local_coords": false, +"preview_sun_env": { +"environ_ao_enabled": false, +"environ_enabled": true, +"environ_energy": 1.0, +"environ_gi_enabled": false, +"environ_glow_enabled": true, +"environ_ground_color": Color(0.2, 0.169, 0.133, 1), +"environ_sky_color": Color(0.385, 0.454, 0.55, 1), +"environ_tonemap_enabled": true, +"sun_color": Color(1, 1, 1, 1), +"sun_enabled": true, +"sun_energy": 1.0, +"sun_max_distance": 100.0, +"sun_rotation": Vector2(-1.0472, 2.61799) +}, +"rotate_snap": 15.0, +"scale_snap": 10.0, +"show_grid": true, +"show_origin": true, +"snap_enabled": false, +"translate_snap": 1.0, +"viewport_mode": 1, +"viewports": [{ +"auto_orthogonal": false, +"auto_orthogonal_enabled": true, +"cinematic_preview": false, +"display_mode": 20, +"distance": 4.0, +"doppler": false, +"frame_time": false, +"gizmos": true, +"half_res": false, +"information": false, +"listener": true, +"lock_rotation": false, +"orthogonal": false, +"position": Vector3(0, 0, 0), +"use_environment": false, +"view_type": 0, +"x_rotation": 0.5, +"y_rotation": -0.5 +}, { +"auto_orthogonal": false, +"auto_orthogonal_enabled": true, +"cinematic_preview": false, +"display_mode": 20, +"distance": 4.0, +"doppler": false, +"frame_time": false, +"gizmos": true, +"half_res": false, +"information": false, +"listener": false, +"lock_rotation": false, +"orthogonal": false, +"position": Vector3(0, 0, 0), +"use_environment": false, +"view_type": 0, +"x_rotation": 0.5, +"y_rotation": -0.5 +}, { +"auto_orthogonal": false, +"auto_orthogonal_enabled": true, +"cinematic_preview": false, +"display_mode": 20, +"distance": 4.0, +"doppler": false, +"frame_time": false, +"gizmos": true, +"half_res": false, +"information": false, +"listener": false, +"lock_rotation": false, +"orthogonal": false, +"position": Vector3(0, 0, 0), +"use_environment": false, +"view_type": 0, +"x_rotation": 0.5, +"y_rotation": -0.5 +}, { +"auto_orthogonal": false, +"auto_orthogonal_enabled": true, +"cinematic_preview": false, +"display_mode": 20, +"distance": 4.0, +"doppler": false, +"frame_time": false, +"gizmos": true, +"half_res": false, +"information": false, +"listener": false, +"lock_rotation": false, +"orthogonal": false, +"position": Vector3(0, 0, 0), +"use_environment": false, +"view_type": 0, +"x_rotation": 0.5, +"y_rotation": -0.5 +}], +"zfar": 4000.01, +"znear": 0.05 +} +selected_nodes=Array[NodePath]([NodePath("/root/@EditorNode@17140/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9462/@VSplitContainer@9281/@HSplitContainer@9283/@HSplitContainer@9285/@Control@9286/@SubViewportContainer@9287/@SubViewport@9288/Control/VBoxContainer/HBoxContainer/MarginContainer2/Coins")]) diff --git a/.godot/editor/ui.tscn-folding-9211dc52ac9df169ba4fe77cbc1dc833.cfg b/.godot/editor/ui.tscn-folding-9211dc52ac9df169ba4fe77cbc1dc833.cfg new file mode 100644 index 0000000..da25aa0 --- /dev/null +++ b/.godot/editor/ui.tscn-folding-9211dc52ac9df169ba4fe77cbc1dc833.cfg @@ -0,0 +1,5 @@ +[folding] + +node_unfolds=[NodePath("VBoxContainer/HBoxContainer/MarginContainer"), PackedStringArray("Layout", "Layout/Container Sizing"), NodePath("VBoxContainer/HBoxContainer/MarginContainer2"), PackedStringArray("Layout", "Layout/Container Sizing")] +resource_unfolds=[] +nodes_folded=[] diff --git a/.godot/global_script_class_cache.cfg b/.godot/global_script_class_cache.cfg index 1775a2f..1ba3b9d 100644 --- a/.godot/global_script_class_cache.cfg +++ b/.godot/global_script_class_cache.cfg @@ -1 +1,19 @@ -list=Array[Dictionary]([]) +list=Array[Dictionary]([{ +"base": &"Area2D", +"class": &"BadGuy", +"icon": "", +"language": &"GDScript", +"path": "res://scripts/badguy.gd" +}, { +"base": &"Resource", +"class": &"Character", +"icon": "", +"language": &"GDScript", +"path": "res://scripts/resources/character_stats.gd" +}, { +"base": &"Area2D", +"class": &"Coin", +"icon": "", +"language": &"GDScript", +"path": "res://scripts/coin.gd" +}]) diff --git a/.godot/uid_cache.bin b/.godot/uid_cache.bin index b17fb40c744944f17fef599a163daf0563fd2a3c..a44ee25561db80474460cc5310e5fcbbc6b68ac1 100644 GIT binary patch delta 200 zcmX@feu;xuf`NhIz{>(o$(MbRI+OP?$xhB>s+%0aY&?-gZ}M{{?aAHDb{mZx87G@C zt4uCt^qwrltTcHaV{3hC`+L5+{~l(VKm&?Wi>>tai<65o3rdRhfxP_EqU6+K{eqmt z%G9Fx;*!LYV!aZe_$2q6cT-ch*K6R>RGgEUn~J0-FaKDSbRILi2$G)EJT9Q|rI~sq H#mRX9v^_@) delta 60 zcmV-C0K@;%2+0Qo6#xJLk=rh_asfdBlh*=ElSBiB3Bc)a2^r~*SuBx%9g!-2lL-MU SlOh8mld}ROk*G71Gyy(jQxpOK diff --git a/project.godot b/project.godot index 2268b83..fdb8bda 100644 --- a/project.godot +++ b/project.godot @@ -15,6 +15,10 @@ run/main_scene="res://scenes/game.tscn" config/features=PackedStringArray("4.2", "Forward Plus") config/icon="res://icon.svg" +[autoload] + +GameManager="*res://scripts/GameManager.gd" + [display] window/size/viewport_width=320 diff --git a/scenes/character.tscn b/scenes/character.tscn index 172986f..d944d4d 100644 --- a/scenes/character.tscn +++ b/scenes/character.tscn @@ -278,3 +278,5 @@ position = Vector2(16, -6) [node name="MarkerLeft" type="Node2D" parent="."] position = Vector2(-16, -6) + +[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animation_finished"] diff --git a/scenes/game.tscn b/scenes/game.tscn index d4e2cfc..36929b0 100644 --- a/scenes/game.tscn +++ b/scenes/game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=19 format=3 uid="uid://y083suj12rld"] +[gd_scene load_steps=20 format=3 uid="uid://y083suj12rld"] [ext_resource type="Script" path="res://scripts/gamecontroller.gd" id="1_77wyw"] [ext_resource type="PackedScene" uid="uid://go4yc8hfo1gq" path="res://scenes/character.tscn" id="2_64ccm"] @@ -11,6 +11,7 @@ [ext_resource type="PackedScene" uid="uid://ci10o5e0xpxm8" path="res://scenes/platform.tscn" id="6_80wa1"] [ext_resource type="PackedScene" uid="uid://cx6o8fh0fj8kl" path="res://scenes/coin.tscn" id="10_0oixj"] [ext_resource type="PackedScene" uid="uid://g7p0pn145hpe" path="res://scenes/badguy.tscn" id="11_bxgbq"] +[ext_resource type="PackedScene" uid="uid://hg2l3bff115k" path="res://scenes/ui.tscn" id="12_x3t78"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_xg6qs"] texture = ExtResource("2_l22q1") @@ -612,9 +613,22 @@ position = Vector2(389, 58) [node name="coin4" parent="Coins" instance=ExtResource("10_0oixj")] position = Vector2(398, -40) -[node name="badguy" parent="." instance=ExtResource("11_bxgbq")] -position = Vector2(153, 146) +[node name="enemies" type="Node" parent="."] + +[node name="badguy" parent="enemies" instance=ExtResource("11_bxgbq")] +position = Vector2(304, 147) + +[node name="badguy2" parent="enemies" instance=ExtResource("11_bxgbq")] +position = Vector2(420, 51) + +[node name="badguy3" parent="enemies" instance=ExtResource("11_bxgbq")] +position = Vector2(155, 147) + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="UI" parent="CanvasLayer" instance=ExtResource("12_x3t78")] [connection signal="timeout" from="GameController/Timer" to="GameController" method="resetWorld"] +[connection signal="deathComplete" from="CharacterBody2D" to="GameController" method="_on_death_complete"] [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/scenes/ui.tscn b/scenes/ui.tscn new file mode 100644 index 0000000..29a0d87 --- /dev/null +++ b/scenes/ui.tscn @@ -0,0 +1,38 @@ +[gd_scene load_steps=2 format=3 uid="uid://hg2l3bff115k"] + +[ext_resource type="Script" path="res://scripts/ui.gd" id="1_4spu6"] + +[node name="Control" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_4spu6") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +grow_horizontal = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] +layout_mode = 2 + +[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="Health" type="Label" parent="VBoxContainer/HBoxContainer/MarginContainer"] +layout_mode = 2 +text = "Health" + +[node name="MarginContainer2" type="MarginContainer" parent="VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="Coins" type="Label" parent="VBoxContainer/HBoxContainer/MarginContainer2"] +layout_mode = 2 +size_flags_horizontal = 8 +text = "Coins" diff --git a/scripts/CharacterBody2D.gd b/scripts/CharacterBody2D.gd index 66066a8..acd94c0 100644 --- a/scripts/CharacterBody2D.gd +++ b/scripts/CharacterBody2D.gd @@ -13,6 +13,10 @@ extends CharacterBody2D @onready var animated_sprite = $AnimatedSprite2D +signal deathComplete + +var currentPlaying = "idle" + var faceLeft = false var pushLeftEnabled = false var pushRightEnabled = false @@ -26,7 +30,8 @@ var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") func die(): print("kill the player") - animated_sprite.play("death") + currentPlaying = "death" + animated_sprite.play(currentPlaying) living = false func _physics_process(delta): @@ -74,27 +79,27 @@ func _physics_process(delta): velocity.x = move_toward(velocity.x, 0, SPEED) if is_on_floor(): if direction==0: - animated_sprite.play("idle") + currentPlaying = "idle" + animated_sprite.play(currentPlaying) else: - animated_sprite.play("run") + currentPlaying="run" + animated_sprite.play(currentPlaying) else: - animated_sprite.play("jump") + currentPlaying = "jump" + animated_sprite.play(currentPlaying) move_and_slide() if right_ray.is_colliding(): - print("right ray is colliding") var collider = right_ray.get_collider() #what did we hit? if collider is Node: if collider.is_in_group("boxes"): - print("This is a pushable box") pushRightEnabled = true pushTarget = collider else: pushRightEnabled = false if left_ray.is_colliding(): - print("left ray is colliding") var collider = left_ray.get_collider() if collider is Node: if collider.is_in_group("boxes"): @@ -108,3 +113,9 @@ func _physics_process(delta): var c = get_slide_collision(i) if c.get_collider() is RigidBody2D: c.get_collider().apply_central_impulse(-c.get_normal()* BUMP_FORCE) + + +func _on_animation_finished(): + if currentPlaying == "death": + print("Animation is Finished is death") + deathComplete.emit() diff --git a/scripts/GameManager.gd b/scripts/GameManager.gd new file mode 100644 index 0000000..49f80f1 --- /dev/null +++ b/scripts/GameManager.gd @@ -0,0 +1,23 @@ +extends Node + +var player: Resource +var coinCollectedTotal:int = 0 + +# Called when the node enters the scene tree for the first time. +func _ready(): + print("GameManager is here!") + player = load("res://scripts/resources/player_stats.tres") + +func coinCollected(): + coinCollectedTotal +=1 + print("coins collected "+str(coinCollectedTotal) ) + +func playerDamage(): + player.health -= 20 + print("Player health is now "+str(player.health) ) +func resetPlayer(): + player.health = player.max_health + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass diff --git a/scripts/badguy.gd b/scripts/badguy.gd index 59671a2..0ffa8a7 100644 --- a/scripts/badguy.gd +++ b/scripts/badguy.gd @@ -1,4 +1,4 @@ -extends Area2D +class_name BadGuy extends Area2D const speed = 60 var direction = 1 @@ -8,7 +8,8 @@ var direction = 1 @onready var right_floor_cast = $rightFloorCast @onready var left_floor_cast = $leftFloorCast @onready var sprite = $AnimatedSprite2D -@onready var game = %GameController + +signal playerDamage # Called when the node enters the scene tree for the first time. func _ready(): @@ -37,4 +38,4 @@ func _process(delta): func _on_body_entered(body): if body.is_in_group("player"): - game.playerDeath() + playerDamage.emit() diff --git a/scripts/coin.gd b/scripts/coin.gd index 338b04c..aa5fd3a 100644 --- a/scripts/coin.gd +++ b/scripts/coin.gd @@ -1,19 +1,9 @@ -extends Area2D -@onready var game = %GameController - - -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta): - pass +class_name Coin extends Area2D +signal coinCollected func _on_body_entered(body): if body.is_in_group("player"): print("something hit the coin") - game.coinCollected() + coinCollected.emit() queue_free() diff --git a/scripts/gamecontroller.gd b/scripts/gamecontroller.gd index 9e4cf77..71d4b2d 100644 --- a/scripts/gamecontroller.gd +++ b/scripts/gamecontroller.gd @@ -4,18 +4,27 @@ var myBox = preload("res://scenes/crate.tscn") @onready var box_trap = $"../BoxTrap" @onready var timer = $Timer @onready var player = $"../CharacterBody2D" +@onready var coins = $"../Coins" +@onready var enemies = $"../enemies" +@onready var ui = $"../CanvasLayer/UI" -var totalCoins = 0 - # Called when the node enters the scene tree for the first time. func _ready(): - pass # Replace with function body. - + GameManager.resetPlayer() + for n in coins.get_children(): + if n is Coin: + #wire up our listener + n.coinCollected.connect(_on_coin_coin_collected) + for n in enemies.get_children(): + if n is BadGuy: + n.playerDamage.connect(playerDamage) # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): - pass + if GameManager.player.health <= 0 && player.living: + player.die() + func _on_area_2d_areatrigger(effect, body): @@ -32,13 +41,20 @@ func _on_area_2d_areatrigger(effect, body): "powerup": print("you got power") -func coinCollected(): - - totalCoins += 1 - print("Game controller will add coin " + str(totalCoins) ) -func playerDeath(): - player.die() - timer.start() - func resetWorld(): get_tree().reload_current_scene() + + +func _on_coin_coin_collected(): + GameManager.coinCollected() + ui.coinsUpdate(GameManager.coinCollectedTotal) + + +func playerDamage(): + GameManager.playerDamage() + ui.healthUpdate(GameManager.player.health) + + +func _on_death_complete(): + #This is where we reset the world + timer.start(.5) diff --git a/scripts/resources/character_stats.gd b/scripts/resources/character_stats.gd new file mode 100644 index 0000000..3d3210b --- /dev/null +++ b/scripts/resources/character_stats.gd @@ -0,0 +1,5 @@ +class_name Character extends Resource + +@export var max_health: int = 100 +@export var starting_health: int = 100 +@export var health: int = 100 diff --git a/scripts/resources/player_stats.tres b/scripts/resources/player_stats.tres new file mode 100644 index 0000000..ba02711 --- /dev/null +++ b/scripts/resources/player_stats.tres @@ -0,0 +1,9 @@ +[gd_resource type="Resource" script_class="Character" load_steps=2 format=3 uid="uid://bvy3omm4l72x2"] + +[ext_resource type="Script" path="res://scripts/resources/character_stats.gd" id="1_m0sqn"] + +[resource] +script = ExtResource("1_m0sqn") +max_health = 100 +starting_health = 100 +health = 100 diff --git a/scripts/resources/slime_stats.tres b/scripts/resources/slime_stats.tres new file mode 100644 index 0000000..9073a0a --- /dev/null +++ b/scripts/resources/slime_stats.tres @@ -0,0 +1,9 @@ +[gd_resource type="Resource" script_class="Character" load_steps=2 format=3 uid="uid://d4d8akkkbbmh3"] + +[ext_resource type="Script" path="res://scripts/resources/character_stats.gd" id="1_wlxgo"] + +[resource] +script = ExtResource("1_wlxgo") +max_health = 50 +starting_health = 50 +health = 50 diff --git a/scripts/ui.gd b/scripts/ui.gd new file mode 100644 index 0000000..2130603 --- /dev/null +++ b/scripts/ui.gd @@ -0,0 +1,12 @@ +extends Control +@onready var health = $VBoxContainer/HBoxContainer/MarginContainer/Health +@onready var coins = $VBoxContainer/HBoxContainer/MarginContainer2/Coins + +func _ready(): + coinsUpdate(GameManager.coinCollectedTotal) + healthUpdate(GameManager.player.health) + +func healthUpdate(amt): + health.text = "Health : "+str(amt) +func coinsUpdate(amt): + coins.text = "Coins : "+str(amt)