game manager and data objects

This commit is contained in:
OddlyTimbot committed 2024-08-19 21:11:13 -04:00
1 parent e4be043988
commit 149ac083d4
38 files changed
+522 -122

No files matched your search

@@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()
@@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01, "zfar": 4000.01,
"znear": 0.05 "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")])
@@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01, "zfar": 4000.01,
"znear": 0.05 "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")])
@@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01, "zfar": 4000.01,
"znear": 0.05 "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")])
@@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()
@@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01, "zfar": 4000.01,
"znear": 0.05 "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")])
@@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01, "zfar": 4000.01,
"znear": 0.05 "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")])
+6 -5
View File
@@ -1,14 +1,15 @@
CanvasLayer
MarginContainer
Label
HBoxContainer
VBoxContainer
Node
Timer Timer
RayCast2D RayCast2D
CollisionShape2D CollisionShape2D
AnimatedSprite2D AnimatedSprite2D
Area2D Area2D
Node
Sprite2D Sprite2D
ParallaxLayer ParallaxLayer
ParallaxBackground ParallaxBackground
Node2D Node2D
AnimationPlayer
AnimatableBody2D
Camera2D
TileMap
+1
View File
@@ -0,0 +1 @@
Character
+6 -6
View File
@@ -19,16 +19,16 @@ dock_filesystem_split=0
dock_filesystem_display_mode=0 dock_filesystem_display_mode=0
dock_filesystem_file_sort=0 dock_filesystem_file_sort=0
dock_filesystem_file_list_display_mode=1 dock_filesystem_file_list_display_mode=1
dock_filesystem_selected_paths=PackedStringArray("res://graphics/Player Death/") dock_filesystem_selected_paths=PackedStringArray("res://scenes/ui.tscn")
dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://", "res://scripts/", "res://scenes/", "res://graphics/", "res://graphics/Player Death/") dock_filesystem_uncollapsed_paths=PackedStringArray("Favorites", "res://", "res://scripts/", "res://scripts/resources/", "res://scenes/", "res://graphics/")
dock_3="Scene,Import" dock_3="Scene,Import"
dock_4="FileSystem" dock_4="FileSystem"
dock_5="Inspector,Node,History" dock_5="Inspector,Node,History"
[EditorNode] [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") 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/game.tscn" current_scene="res://scenes/ui.tscn"
center_split_offset=-247 center_split_offset=-247
selected_default_debugger_tab_idx=0 selected_default_debugger_tab_idx=0
selected_main_editor_idx=2 selected_main_editor_idx=2
@@ -36,8 +36,8 @@ selected_bottom_panel_item=0
[ScriptEditor] [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"] 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/gamecontroller.gd" selected_script="res://scripts/ui.gd"
open_help=[] open_help=[]
script_split_offset=70 script_split_offset=70
list_split_offset=0 list_split_offset=0
View File
Whitespace-only changes.
+41 -40
View File
@@ -1,41 +1,42 @@
ea4bc82a6ad023ab7ee23ee620429895 ea4bc82a6ad023ab7ee23ee620429895
::res://::1723499748 ::res://::1724106263
icon.svg::CompressedTexture2D::9114977118871582245::1723499516::1723499516::1::::<><>:: icon.svg::CompressedTexture2D::9114977118871582245::1724102900::1724102900::1::::<><>::
::res://graphics/::1723509991 ::res://graphics/::1724102900
bullet.png::CompressedTexture2D::4834894094516681527::1723499516::1723499516::1::::<><>:: bullet.png::CompressedTexture2D::4834894094516681527::1724102900::1724102900::1::::<><>::
Terrain (32x32).png::CompressedTexture2D::8707534964839485024::1723499516::1723499516::1::::<><>:: Terrain (32x32).png::CompressedTexture2D::8707534964839485024::1724102900::1724102900::1::::<><>::
::res://graphics/background/::1723501213 ::res://graphics/background/::1724102900
Additional Sky.png::CompressedTexture2D::6453351609810348480::1723501213::1723501213::1::::<><>:: Additional Sky.png::CompressedTexture2D::6453351609810348480::1724102900::1724102900::1::::<><>::
Additional Water.png::CompressedTexture2D::4106022825291545778::1723501213::1723501213::1::::<><>:: Additional Water.png::CompressedTexture2D::4106022825291545778::1724102900::1724102900::1::::<><>::
BG Image.png::CompressedTexture2D::237374342318087251::1723501213::1723501213::1::::<><>:: BG Image.png::CompressedTexture2D::237374342318087251::1724102900::1724102900::1::::<><>::
::res://graphics/enemies/::1723506305 ::res://graphics/enemies/::1724102900
slime_purple.png::CompressedTexture2D::4414376887898401849::1723506305::1723506305::1::::<><>:: slime_purple.png::CompressedTexture2D::4414376887898401849::1724102900::1724102900::1::::<><>::
::res://graphics/items/::1723499516 ::res://graphics/items/::1724102900
cannister.png::CompressedTexture2D::7418095402531000042::1723499516::1723499516::1::::<><>:: cannister.png::CompressedTexture2D::7418095402531000042::1724102900::1724102900::1::::<><>::
::res://graphics/pickups/::1723502323 ::res://graphics/pickups/::1724102900
coin.png::CompressedTexture2D::9033362620640926021::1723502323::1723502323::1::::<><>:: coin.png::CompressedTexture2D::9033362620640926021::1724102900::1724102900::1::::<><>::
::res://graphics/Player Death/::1723509999 ::res://graphics/Player Death/::1724102900
Player Death 64x64.png::CompressedTexture2D::116608705279953946::1723509999::1723509999::1::::<><>:: Player Death 64x64.png::CompressedTexture2D::116608705279953946::1724102900::1724102900::1::::<><>::
::res://graphics/Player Idle/::1723499516 ::res://graphics/Player Idle/::1724102900
Player Idle 48x48.png::CompressedTexture2D::6544563428604246579::1723499516::1723499516::1::::<><>:: Player Idle 48x48.png::CompressedTexture2D::6544563428604246579::1724102900::1724102900::1::::<><>::
::res://graphics/Player Jump/::1723499516 ::res://graphics/Player Jump/::1724102900
player jump 48x48.png::CompressedTexture2D::1627608568707791839::1723499516::1723499516::1::::<><>:: player jump 48x48.png::CompressedTexture2D::1627608568707791839::1724102900::1724102900::1::::<><>::
::res://graphics/Player Land/::1723499516 ::res://graphics/Player Land/::1724102900
player land 48x48.png::CompressedTexture2D::3499637713582873633::1723499516::1723499516::1::::<><>:: player land 48x48.png::CompressedTexture2D::3499637713582873633::1724102900::1724102900::1::::<><>::
::res://graphics/Player Run/::1723499516 ::res://graphics/Player Run/::1724102900
player run 48x48.png::CompressedTexture2D::1502492849971408816::1723499516::1723499516::1::::<><>:: player run 48x48.png::CompressedTexture2D::1502492849971408816::1724102900::1724102900::1::::<><>::
::res://scenes/::1723509898 ::res://scenes/::1724108421
badguy.tscn::PackedScene::488149358851198558::1723509898::0::1::::<><>::uid://b35me3ux1dl8t::::res://graphics/enemies/slime_purple.png<>res://scripts/badguy.gd badguy.tscn::PackedScene::488149358851198558::1724108421::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 bullet.tscn::PackedScene::6880909734590904373::1724108421::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 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::1723509898::0::1::::<><>::res://scripts/coin.gd<>uid://d1x3fr6xxt4mr::::res://graphics/pickups/coin.png coin.tscn::PackedScene::6452089725107733211::1724108421::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 crate.tscn::PackedScene::41931541512830250::1724108421::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 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::1723509898::0::1::::<><>:: platform.tscn::PackedScene::5389570447076805405::1724108421::0::1::::<><>::
::res://scripts/::1723509883 ::res://scripts/::1724108421
badguy.gd::GDScript::-1::1723509883::0::1::::<>Area2D<>:: badguy.gd::GDScript::-1::1724102900::0::1::::<>Area2D<>::
bullet.gd::GDScript::-1::1723499516::0::1::::<>Area2D<>:: bullet.gd::GDScript::-1::1724102900::0::1::::<>Area2D<>::
CharacterBody2D.gd::GDScript::-1::1723499516::0::1::::<>CharacterBody2D<>:: CharacterBody2D.gd::GDScript::-1::1724102900::0::1::::<>CharacterBody2D<>::
coin.gd::GDScript::-1::1723504932::0::1::::<>Area2D<>:: coin.gd::GDScript::-1::1724107621::0::1::::Coin<>Area2D<>::
gamecontroller.gd::GDScript::-1::1723509526::0::1::::<>Node<>:: gamecontroller.gd::GDScript::-1::1724108299::0::1::::<>Node<>::
Trigger.gd::GDScript::-1::1723499516::0::1::::<>Area2D<>:: GameManager.gd::GDScript::-1::1724108421::0::1::::<>Node<>::
Trigger.gd::GDScript::-1::1724102900::0::1::::<>Area2D<>::
+6 -1
View File
@@ -4,8 +4,13 @@ res://scenes/bullet.tscn
res://scenes/crate.tscn res://scenes/crate.tscn
res://scenes/platform.tscn res://scenes/platform.tscn
res://scenes/coin.tscn res://scenes/coin.tscn
res://scenes/badguy.tscn
res://scripts/GameManager.gd
res://scripts/coin.gd res://scripts/coin.gd
res://scripts/gamecontroller.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/badguy.gd
res://scripts/CharacterBody2D.gd res://scripts/CharacterBody2D.gd
res://scenes/ui.tscn
res://scripts/ui.gd
@@ -8,7 +8,7 @@ Anim={
"grid_snap_active": false, "grid_snap_active": false,
"grid_step": Vector2(8, 8), "grid_step": Vector2(8, 8),
"grid_visibility": 1, "grid_visibility": 1,
"ofs": Vector2(-206.898, -321.44), "ofs": Vector2(-78.8771, -80.2392),
"primary_grid_step": Vector2i(8, 8), "primary_grid_step": Vector2i(8, 8),
"show_edit_locks": true, "show_edit_locks": true,
"show_guides": true, "show_guides": true,
@@ -32,7 +32,7 @@ Anim={
"snap_rotation_step": 0.261799, "snap_rotation_step": 0.261799,
"snap_scale": false, "snap_scale": false,
"snap_scale_step": 0.1, "snap_scale_step": 0.1,
"zoom": 1.18921 "zoom": 1.49831
} }
3D={ 3D={
"fov": 70.01, "fov": 70.01,
@@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01, "zfar": 4000.01,
"znear": 0.05 "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")])
@@ -172,4 +172,4 @@ Anim={
"zfar": 4000.01, "zfar": 4000.01,
"znear": 0.05 "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")])
@@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()
+8 -2
View File
@@ -14,8 +14,8 @@ run_debug_collisions=true
[recent_files] [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"] 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/badguy.gd", "res://scripts/coin.gd", "res://scripts/Trigger.gd", "res://scripts/bullet.gd", "res://scripts/CharacterBody2D.gd", "res://scripts/gamecontroller.gd"] 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] [linked_properties]
@@ -37,6 +37,12 @@ ParallaxBackground:scroll_base_scale=true
ParallaxBackground:scale=true ParallaxBackground:scale=true
ParallaxLayer:motion_scale=true ParallaxLayer:motion_scale=true
ParallaxLayer: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] [dialog_bounds]
+3 -2
View File
@@ -1,7 +1,8 @@
res://graphics/Player Death
res://scripts res://scripts
res://graphics/enemies
res://scenes res://scenes
res://scripts/resources/
res://graphics/Player Death
res://graphics/enemies
res://graphics/pickups res://graphics/pickups
res://graphics/Player Jump res://graphics/Player Jump
res://graphics/Player Run res://graphics/Player Run
+55 -17
View File
@@ -3,11 +3,11 @@
state={ state={
"bookmarks": PackedInt32Array(), "bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(), "breakpoints": PackedInt32Array(),
"column": 14, "column": 42,
"folded_lines": Array[int]([]), "folded_lines": Array[int]([]),
"h_scroll_position": 0, "h_scroll_position": 0,
"row": 40, "row": 54,
"scroll_position": 28.0, "scroll_position": 43.0,
"selection": false, "selection": false,
"syntax_highlighter": "GDScript" "syntax_highlighter": "GDScript"
} }
@@ -17,16 +17,12 @@ state={
state={ state={
"bookmarks": PackedInt32Array(), "bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(), "breakpoints": PackedInt32Array(),
"column": 0, "column": 27,
"folded_lines": Array[int]([]), "folded_lines": Array[int]([]),
"h_scroll_position": 0, "h_scroll_position": 0,
"row": 26, "row": 81,
"scroll_position": 20.0, "scroll_position": 75.0,
"selection": true, "selection": false,
"selection_from_column": 0,
"selection_from_line": 26,
"selection_to_column": 15,
"selection_to_line": 29,
"syntax_highlighter": "GDScript" "syntax_highlighter": "GDScript"
} }
@@ -63,11 +59,11 @@ state={
state={ state={
"bookmarks": PackedInt32Array(), "bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(), "breakpoints": PackedInt32Array(),
"column": 14, "column": 16,
"folded_lines": Array[int]([]), "folded_lines": Array[int]([]),
"h_scroll_position": 0, "h_scroll_position": 0,
"row": 18, "row": 0,
"scroll_position": 1.0, "scroll_position": 0.0,
"selection": false, "selection": false,
"syntax_highlighter": "GDScript" "syntax_highlighter": "GDScript"
} }
@@ -77,11 +73,53 @@ state={
state={ state={
"bookmarks": PackedInt32Array(), "bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(), "breakpoints": PackedInt32Array(),
"column": 31, "column": 18,
"folded_lines": Array[int]([]), "folded_lines": Array[int]([]),
"h_scroll_position": 0, "h_scroll_position": 0,
"row": 38, "row": 0,
"scroll_position": 24.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, "selection": false,
"syntax_highlighter": "GDScript" "syntax_highlighter": "GDScript"
} }
@@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()
@@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()
@@ -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")])
@@ -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=[]
+19 -1
View File
@@ -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"
}])
Binary file not shown.
+4
View File
@@ -15,6 +15,10 @@ run/main_scene="res://scenes/game.tscn"
config/features=PackedStringArray("4.2", "Forward Plus") config/features=PackedStringArray("4.2", "Forward Plus")
config/icon="res://icon.svg" config/icon="res://icon.svg"
[autoload]
GameManager="*res://scripts/GameManager.gd"
[display] [display]
window/size/viewport_width=320 window/size/viewport_width=320
+2
View File
@@ -278,3 +278,5 @@ position = Vector2(16, -6)
[node name="MarkerLeft" type="Node2D" parent="."] [node name="MarkerLeft" type="Node2D" parent="."]
position = Vector2(-16, -6) position = Vector2(-16, -6)
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animation_finished"]
+17 -3
View File
@@ -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="Script" path="res://scripts/gamecontroller.gd" id="1_77wyw"]
[ext_resource type="PackedScene" uid="uid://go4yc8hfo1gq" path="res://scenes/character.tscn" id="2_64ccm"] [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://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://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://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"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_xg6qs"]
texture = ExtResource("2_l22q1") texture = ExtResource("2_l22q1")
@@ -612,9 +613,22 @@ position = Vector2(389, 58)
[node name="coin4" parent="Coins" instance=ExtResource("10_0oixj")] [node name="coin4" parent="Coins" instance=ExtResource("10_0oixj")]
position = Vector2(398, -40) position = Vector2(398, -40)
[node name="badguy" parent="." instance=ExtResource("11_bxgbq")] [node name="enemies" type="Node" parent="."]
position = Vector2(153, 146)
[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="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="areatrigger" from="AreaTrigger" to="GameController" method="_on_area_2d_areatrigger"]
[connection signal="body_entered" from="AreaTrigger" to="AreaTrigger" method="_on_body_entered"] [connection signal="body_entered" from="AreaTrigger" to="AreaTrigger" method="_on_body_entered"]
+38
View File
@@ -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"
+18 -7
View File
@@ -13,6 +13,10 @@ extends CharacterBody2D
@onready var animated_sprite = $AnimatedSprite2D @onready var animated_sprite = $AnimatedSprite2D
signal deathComplete
var currentPlaying = "idle"
var faceLeft = false var faceLeft = false
var pushLeftEnabled = false var pushLeftEnabled = false
var pushRightEnabled = false var pushRightEnabled = false
@@ -26,7 +30,8 @@ var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
func die(): func die():
print("kill the player") print("kill the player")
animated_sprite.play("death") currentPlaying = "death"
animated_sprite.play(currentPlaying)
living = false living = false
func _physics_process(delta): func _physics_process(delta):
@@ -74,27 +79,27 @@ func _physics_process(delta):
velocity.x = move_toward(velocity.x, 0, SPEED) velocity.x = move_toward(velocity.x, 0, SPEED)
if is_on_floor(): if is_on_floor():
if direction==0: if direction==0:
animated_sprite.play("idle") currentPlaying = "idle"
animated_sprite.play(currentPlaying)
else: else:
animated_sprite.play("run") currentPlaying="run"
animated_sprite.play(currentPlaying)
else: else:
animated_sprite.play("jump") currentPlaying = "jump"
animated_sprite.play(currentPlaying)
move_and_slide() move_and_slide()
if right_ray.is_colliding(): if right_ray.is_colliding():
print("right ray is colliding")
var collider = right_ray.get_collider() var collider = right_ray.get_collider()
#what did we hit? #what did we hit?
if collider is Node: if collider is Node:
if collider.is_in_group("boxes"): if collider.is_in_group("boxes"):
print("This is a pushable box")
pushRightEnabled = true pushRightEnabled = true
pushTarget = collider pushTarget = collider
else: else:
pushRightEnabled = false pushRightEnabled = false
if left_ray.is_colliding(): if left_ray.is_colliding():
print("left ray is colliding")
var collider = left_ray.get_collider() var collider = left_ray.get_collider()
if collider is Node: if collider is Node:
if collider.is_in_group("boxes"): if collider.is_in_group("boxes"):
@@ -108,3 +113,9 @@ func _physics_process(delta):
var c = get_slide_collision(i) var c = get_slide_collision(i)
if c.get_collider() is RigidBody2D: if c.get_collider() is RigidBody2D:
c.get_collider().apply_central_impulse(-c.get_normal()* BUMP_FORCE) 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()
+23
View File
@@ -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
+4 -3
View File
@@ -1,4 +1,4 @@
extends Area2D class_name BadGuy extends Area2D
const speed = 60 const speed = 60
var direction = 1 var direction = 1
@@ -8,7 +8,8 @@ var direction = 1
@onready var right_floor_cast = $rightFloorCast @onready var right_floor_cast = $rightFloorCast
@onready var left_floor_cast = $leftFloorCast @onready var left_floor_cast = $leftFloorCast
@onready var sprite = $AnimatedSprite2D @onready var sprite = $AnimatedSprite2D
@onready var game = %GameController
signal playerDamage
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
@@ -37,4 +38,4 @@ func _process(delta):
func _on_body_entered(body): func _on_body_entered(body):
if body.is_in_group("player"): if body.is_in_group("player"):
game.playerDeath() playerDamage.emit()
+3 -13
View File
@@ -1,19 +1,9 @@
extends Area2D class_name Coin 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
signal coinCollected
func _on_body_entered(body): func _on_body_entered(body):
if body.is_in_group("player"): if body.is_in_group("player"):
print("something hit the coin") print("something hit the coin")
game.coinCollected() coinCollected.emit()
queue_free() queue_free()
+29 -13
View File
@@ -4,18 +4,27 @@ var myBox = preload("res://scenes/crate.tscn")
@onready var box_trap = $"../BoxTrap" @onready var box_trap = $"../BoxTrap"
@onready var timer = $Timer @onready var timer = $Timer
@onready var player = $"../CharacterBody2D" @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. # Called when the node enters the scene tree for the first time.
func _ready(): 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. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta): func _process(delta):
pass if GameManager.player.health <= 0 && player.living:
player.die()
func _on_area_2d_areatrigger(effect, body): func _on_area_2d_areatrigger(effect, body):
@@ -32,13 +41,20 @@ func _on_area_2d_areatrigger(effect, body):
"powerup": "powerup":
print("you got power") print("you got power")
func coinCollected():
totalCoins += 1
print("Game controller will add coin " + str(totalCoins) )
func playerDeath():
player.die()
timer.start()
func resetWorld(): func resetWorld():
get_tree().reload_current_scene() 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)
+5
View File
@@ -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
+9
View File
@@ -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
+9
View File
@@ -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
+12
View File
@@ -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)