game manager and data objects

This commit is contained in:
winniewk 2024-08-19 21:11:17 -04:00
parent d4b5181c01
commit 6fcd33bb18
43 changed files with 582 additions and 145 deletions

View File

@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()

View File

@ -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(-191, -74),
"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")])

View File

@ -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"), NodePath("VBoxContainer/HBoxContainer/MarginContainer2/Coins"), PackedStringArray("Layout", "Layout/Container Sizing")]
resource_unfolds=[]
nodes_folded=[]

View File

@ -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")])

View File

@ -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")])

View File

@ -8,7 +8,7 @@ Anim={
"grid_snap_active": false,
"grid_step": Vector2(8, 8),
"grid_visibility": 1,
"ofs": Vector2(-103.803, -28.6502),
"ofs": Vector2(-183.753, -70.207),
"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": 5.99323
"zoom": 3.5636
}
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")])

View File

@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()

View File

@ -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")])

View File

@ -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")])

View File

@ -1,14 +1,15 @@
CanvasLayer
MarginContainer
Label
HBoxContainer
VBoxContainer
Node
Timer
RayCast2D
CollisionShape2D
AnimatedSprite2D
Area2D
Node
Sprite2D
ParallaxLayer
ParallaxBackground
Node2D
AnimationPlayer
AnimatableBody2D
Camera2D
TileMap

View File

@ -0,0 +1 @@
Character

View File

@ -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/", "res://graphics/pickups/", "res://graphics/enemies/")
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/", "res://graphics/Player Death/", "res://graphics/pickups/", "res://graphics/enemies/")
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=-397
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

View File

View File

@ -1,42 +1,49 @@
ea4bc82a6ad023ab7ee23ee620429895
::res://::1723510012
icon.svg::CompressedTexture2D::9114977118871582245::1723500937::1723500937::1::::<><>::
::res://graphics/::1723510012
Terrain (32x32).png::CompressedTexture2D::8707534964839485024::1723500937::1723500937::1::::<><>::
::res://graphics/background/::1723502317
Additional Sky.png::CompressedTexture2D::7405875053565000941::1723501352::1723501363::1::::<><>::
Additional Water.png::CompressedTexture2D::5548836167267955277::1723501352::1723501363::1::::<><>::
BG Image.png::CompressedTexture2D::4005256289399045782::1723501352::1723501363::1::::<><>::
::res://graphics/enemies/::1723506310
slime_green.png::CompressedTexture2D::1134669905662794867::1723506254::1723506310::1::::<><>::
slime_purple.png::CompressedTexture2D::3992152575753882488::1723506254::1723506310::1::::<><>::
::res://graphics/items/::1723500937
bullet.png::CompressedTexture2D::4146801143722277085::1723500937::1723500937::1::::<><>::
cannister.png::CompressedTexture2D::7418095402531000042::1723500937::1723500937::1::::<><>::
::res://graphics/pickups/::1723502549
coin.png::CompressedTexture2D::3843186516589658432::1723502532::1723502549::1::::<><>::
::res://graphics/Player Death/::1723510012
Player Death 64x64.png::CompressedTexture2D::7118346198518807013::1723509990::1723510012::1::::<><>::
::res://graphics/Player Idle/::1723500937
Player Idle 48x48.png::CompressedTexture2D::6544563428604246579::1723500937::1723500937::1::::<><>::
::res://graphics/Player Jump/::1723500937
player jump 48x48.png::CompressedTexture2D::1627608568707791839::1723500937::1723500937::1::::<><>::
::res://graphics/Player Land/::1723500937
player land 48x48.png::CompressedTexture2D::3499637713582873633::1723500937::1723500937::1::::<><>::
::res://graphics/Player Run/::1723500937
player run 48x48.png::CompressedTexture2D::1502492849971408816::1723500937::1723500937::1::::<><>::
::res://scenes/::1723509760
badguy.tscn::PackedScene::8649992596256653425::1723509760::0::1::::<><>::res://scripts/badguy.gd<>uid://bw43f1enjixbk::::res://graphics/enemies/slime_purple.png
bullet.tscn::PackedScene::6880909734590904373::1723509745::0::1::::<><>::res://scripts/bullet.gd<>uid://b0c0hdt3afypx::::res://graphics/items/bullet.png
character.tscn::PackedScene::451838158579532324::1723509745::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::2256142337678812705::1723509745::0::1::::<><>::uid://bu0wyq230xip1::::res://graphics/pickups/coin.png<>res://scripts/coin.gd
crate.tscn::PackedScene::41931541512830250::1723509745::0::1::::<><>::uid://ddxm7hj323fta::::res://graphics/items/cannister.png
game.tscn::PackedScene::1738196330916037717::1723509745::0::1::::<><>::res://scripts/gamecontroller.gd<>uid://go4yc8hfo1gq::::res://scenes/character.tscn<>uid://dwb83f7uoweuy::::res://graphics/Terrain (32x32).png<>res://scripts/Trigger.gd<>uid://bxcf8ryispa5c::::res://graphics/background/BG Image.png<>uid://ddrpxehpjros0::::res://graphics/background/Additional Sky.png<>uid://clb5ryiub2nfh::::res://graphics/background/Additional Water.png<>uid://ukuu7p7vhlq::::res://scenes/crate.tscn<>uid://i3l8y3rbx4o1::::res://scenes/platform.tscn<>uid://7e5lm5ck08k8::::res://scenes/coin.tscn<>uid://dvied5dxkc7e0::::res://scenes/badguy.tscn
platform.tscn::PackedScene::620041448926829138::1723509745::0::1::::<><>::
::res://scripts/::1723509745
badguy.gd::GDScript::-1::1723509745::0::1::::<>Area2D<>::
bullet.gd::GDScript::-1::1723500937::0::1::::<>Area2D<>::
CharacterBody2D.gd::GDScript::-1::1723500937::0::1::::<>CharacterBody2D<>::
coin.gd::GDScript::-1::1723504936::0::1::::<>Area2D<>::
gamecontroller.gd::GDScript::-1::1723509527::0::1::::<>Node<>::
Trigger.gd::GDScript::-1::1723500937::0::1::::<>Area2D<>::
::res://::1724114754
icon.svg::CompressedTexture2D::9114977118871582245::1724105502::1724105502::1::::<><>::
::res://graphics/::1724105502
Terrain (32x32).png::CompressedTexture2D::8707534964839485024::1724105502::1724105502::1::::<><>::
::res://graphics/background/::1724111161
Additional Sky.png::CompressedTexture2D::7405875053565000941::1724105502::1724105502::1::::<><>::
Additional Water.png::CompressedTexture2D::5548836167267955277::1724105502::1724105502::1::::<><>::
BG Image.png::CompressedTexture2D::4005256289399045782::1724105502::1724105502::1::::<><>::
Office.JPG::CompressedTexture2D::791945994043862159::1724079126::1724111161::1::::<><>::
::res://graphics/enemies/::1724105502
slime_green.png::CompressedTexture2D::1134669905662794867::1724105502::1724105502::1::::<><>::
slime_purple.png::CompressedTexture2D::3992152575753882488::1724105502::1724105502::1::::<><>::
::res://graphics/items/::1724105502
bullet.png::CompressedTexture2D::4146801143722277085::1724105502::1724105502::1::::<><>::
cannister.png::CompressedTexture2D::7418095402531000042::1724105502::1724105502::1::::<><>::
::res://graphics/pickups/::1724105502
coin.png::CompressedTexture2D::3843186516589658432::1724105502::1724105502::1::::<><>::
::res://graphics/Player Death/::1724105502
Player Death 64x64.png::CompressedTexture2D::7118346198518807013::1724105502::1724105502::1::::<><>::
::res://graphics/Player Idle/::1724105502
Player Idle 48x48.png::CompressedTexture2D::6544563428604246579::1724105502::1724105502::1::::<><>::
::res://graphics/Player Jump/::1724105502
player jump 48x48.png::CompressedTexture2D::1627608568707791839::1724105502::1724105502::1::::<><>::
::res://graphics/Player Land/::1724105502
player land 48x48.png::CompressedTexture2D::3499637713582873633::1724105502::1724105502::1::::<><>::
::res://graphics/Player Run/::1724105502
player run 48x48.png::CompressedTexture2D::1502492849971408816::1724105502::1724105502::1::::<><>::
::res://scenes/::1724114738
badguy.tscn::PackedScene::8649992596256653425::1724114710::0::1::::<><>::res://scripts/badguy.gd<>uid://bw43f1enjixbk::::res://graphics/enemies/slime_purple.png
bullet.tscn::PackedScene::6880909734590904373::1724114710::0::1::::<><>::res://scripts/bullet.gd<>uid://b0c0hdt3afypx::::res://graphics/items/bullet.png
character.tscn::PackedScene::451838158579532324::1724114710::0::1::::<><>::res://scripts/CharacterBody2D.gd<>uid://c8ogee5u6uxld::::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::2256142337678812705::1724114710::0::1::::<><>::uid://bu0wyq230xip1::::res://graphics/pickups/coin.png<>res://scripts/coin.gd
crate.tscn::PackedScene::41931541512830250::1724114710::0::1::::<><>::uid://ddxm7hj323fta::::res://graphics/items/cannister.png
game.tscn::PackedScene::1738196330916037717::1724114710::0::1::::<><>::res://scripts/gamecontroller.gd<>uid://go4yc8hfo1gq::::res://scenes/character.tscn<>uid://dwb83f7uoweuy::::res://graphics/Terrain (32x32).png<>res://scripts/Trigger.gd<>uid://bxcf8ryispa5c::::res://graphics/background/BG Image.png<>uid://ddrpxehpjros0::::res://graphics/background/Additional Sky.png<>uid://clb5ryiub2nfh::::res://graphics/background/Additional Water.png<>uid://ukuu7p7vhlq::::res://scenes/crate.tscn<>uid://i3l8y3rbx4o1::::res://scenes/platform.tscn<>uid://7e5lm5ck08k8::::res://scenes/coin.tscn<>uid://dvied5dxkc7e0::::res://scenes/badguy.tscn<>uid://whe4bf2tp6ro::::res://scenes/UI.tscn
platform.tscn::PackedScene::620041448926829138::1724114710::0::1::::<><>::
UI.tscn::PackedScene::1558899921809583764::1724114738::0::1::::<><>::
::res://scripts/::1724112968
badguy.gd::GDScript::-1::1724110539::0::1::::BadGuy<>Area2D<>::
bullet.gd::GDScript::-1::1724105502::0::1::::<>Area2D<>::
CharacterBody2D.gd::GDScript::-1::1724112968::0::1::::<>CharacterBody2D<>::
coin.gd::GDScript::-1::1724107621::0::1::::Coin<>Area2D<>::
gamecontroller.gd::GDScript::-1::1724112968::0::1::::<>Node<>::
GameManager.gd::GDScript::-1::1724110435::0::1::::<>Node<>::
Trigger.gd::GDScript::-1::1724105502::0::1::::<>Area2D<>::
::res://scripts/resources/::1724109250
character_stats.gd::GDScript::-1::1724109017::0::1::::Character<>Resource<>::
player_stats.tres::Resource/Resource::6555960363735383756::1724109250::0::1::::<><>::res://scripts/resources/character_stats.gd
slime_stats.tres::Resource/Resource::7258006838405658173::1724109250::0::1::::<><>::res://scripts/resources/character_stats.gd

View File

@ -5,6 +5,6 @@ res://scenes/crate.tscn
res://scenes/platform.tscn
res://scenes/coin.tscn
res://scenes/badguy.tscn
res://scenes/UI.tscn
res://scripts/ui.gd
res://scripts/gamecontroller.gd
res://scripts/badguy.gd
res://scripts/CharacterBody2D.gd

View File

@ -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")])

View File

@ -1,5 +1,5 @@
[folding]
node_unfolds=[NodePath("."), PackedStringArray("Transform"), NodePath("TileMap"), PackedStringArray("tile_set"), NodePath("ParallaxBackground/ParallaxLayer"), PackedStringArray("Motion"), NodePath("ParallaxBackground/ParallaxLayer/Sprite2D"), PackedStringArray("Transform"), NodePath("ParallaxBackground/ParallaxLayer/Sprite2D2"), PackedStringArray("Transform"), NodePath("ParallaxBackground/ParallaxLayer/Sprite2D3"), PackedStringArray("Transform"), NodePath("level"), PackedStringArray("Transform"), NodePath("level/StaticBody2D"), PackedStringArray("Transform"), NodePath("AreaTrigger"), PackedStringArray("Transform"), NodePath("Platform"), PackedStringArray("Transform")]
node_unfolds=[NodePath("."), PackedStringArray("Transform"), NodePath("TileMap"), PackedStringArray("tile_set"), NodePath("ParallaxBackground/ParallaxLayer"), PackedStringArray("Motion"), NodePath("ParallaxBackground/ParallaxLayer/Sprite2D"), PackedStringArray("Transform"), NodePath("ParallaxBackground/ParallaxLayer/Sprite2D2"), PackedStringArray("Transform"), NodePath("ParallaxBackground/ParallaxLayer/Sprite2D3"), PackedStringArray("Transform"), NodePath("level"), PackedStringArray("Transform"), NodePath("level/StaticBody2D"), PackedStringArray("Transform"), NodePath("AreaTrigger"), PackedStringArray("Transform"), NodePath("Platform"), PackedStringArray("Transform"), NodePath("CanvasLayer/UI"), PackedStringArray("Visibility")]
resource_unfolds=["res://scenes/game.tscn::TileSet_47g5u", PackedStringArray("physics_layer__array"), "res://scenes/game.tscn::WorldBoundaryShape2D_3u4a8", PackedStringArray("Resource"), "res://scenes/game.tscn::CircleShape2D_x8qck", PackedStringArray("Resource")]
nodes_folded=[NodePath("AreaTrigger")]

View File

@ -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")])

View File

@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()

View File

@ -1,6 +1,6 @@
[editor_metadata]
executable_path="/home/timberg/Documents/software/godot/Godot_v4.2.1-stable_linux.x86_64"
executable_path="/home/timbuntu/Documents/software/godot/Godot_v4.2.1-stable_linux.x86_64"
use_advanced_connections=false
tile_source_sort=0
tile_snap_option=0
@ -10,12 +10,12 @@ tile_snap_subdiv=4.0
run_live_debug=true
run_reload_scripts=true
run_debug_collisions=true
run_debug_collisions=false
[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
HBoxContainer:scale=true
Label:scale=true
MarginContainer:scale=true
CanvasLayer:scale=true
[dialog_bounds]

View File

@ -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

View File

@ -3,11 +3,11 @@
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 13,
"column": 42,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 37,
"scroll_position": 25.0,
"row": 51,
"scroll_position": 34.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
@ -17,11 +17,11 @@ state={
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 15,
"column": 20,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 28,
"scroll_position": 20.0,
"row": 15,
"scroll_position": 9.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
@ -59,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"
}
@ -73,11 +73,53 @@ state={
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 20,
"column": 18,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 38,
"scroll_position": 22.0,
"row": 0,
"scroll_position": 0.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
[res://scripts/GameManager.gd]
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 49,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 15,
"scroll_position": 0.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
[res://scripts/resources/character_stats.gd]
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 8,
"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"
}

View File

@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()

View File

@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()

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"
}])

View File

@ -0,0 +1,3 @@
source_md5="4cdcf644c4a0fe9f14bda6bd8a675111"
dest_md5="3787d5d2564ead721fcda28ddc2bd291"

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ljvh8piur8pf"
path="res://.godot/imported/Office.JPG-e620f1f1a5c95745c7525541c68ba3f1.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://graphics/background/Office.JPG"
dest_files=["res://.godot/imported/Office.JPG-e620f1f1a5c95745c7525541c68ba3f1.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@ -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

38
scenes/UI.tscn Normal file
View File

@ -0,0 +1,38 @@
[gd_scene load_steps=2 format=3 uid="uid://whe4bf2tp6ro"]
[ext_resource type="Script" path="res://scripts/ui.gd" id="1_piw7r"]
[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_piw7r")
[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"

View File

@ -258,10 +258,8 @@ metadata/_edit_group_ = true
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
texture_filter = 1
sprite_frames = SubResource("SpriteFrames_a6t6h")
animation = &"death"
animation = &"idle"
autoplay = "idle"
frame = 9
frame_progress = 1.0
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 3)
@ -280,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"]

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="PackedScene" uid="uid://go4yc8hfo1gq" path="res://scenes/character.tscn" id="2_64ccm"]
@ -11,6 +11,7 @@
[ext_resource type="PackedScene" uid="uid://i3l8y3rbx4o1" path="res://scenes/platform.tscn" id="6_t5a05"]
[ext_resource type="PackedScene" uid="uid://7e5lm5ck08k8" path="res://scenes/coin.tscn" id="10_yjg5o"]
[ext_resource type="PackedScene" uid="uid://dvied5dxkc7e0" path="res://scenes/badguy.tscn" id="11_ovphn"]
[ext_resource type="PackedScene" uid="uid://whe4bf2tp6ro" path="res://scenes/UI.tscn" id="12_pvhor"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_xg6qs"]
texture = ExtResource("2_l22q1")
@ -606,65 +607,81 @@ autoplay = "move"
[node name="BoxTrap" type="Node2D" parent="."]
position = Vector2(304, -140)
[node name="coins" type="Node" parent="."]
[node name="Coins" type="Node" parent="."]
[node name="coin" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(208, -11)
[node name="coin2" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin2" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(407, -138)
[node name="coin3" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin3" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(459, -139)
[node name="coin4" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin4" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(-16, -9)
[node name="coin5" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin5" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(-95, -74)
[node name="coin6" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin6" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(48, -44)
[node name="coin7" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin7" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(264, 83)
[node name="coin8" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin8" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(312, 83)
[node name="coin9" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin9" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(357, 82)
[node name="coin10" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin10" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(306, -42)
[node name="coin11" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin11" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(397, 83)
[node name="coin12" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin12" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(467, 20)
[node name="coin13" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin13" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(494, 20)
[node name="coin14" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin14" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(527, -110)
[node name="coin15" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin15" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(536, -44)
[node name="coin16" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin16" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(560, -44)
[node name="coin17" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin17" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(584, -44)
[node name="coin18" parent="coins" instance=ExtResource("10_yjg5o")]
[node name="coin18" parent="Coins" instance=ExtResource("10_yjg5o")]
position = Vector2(218, 83)
[node name="badguy" parent="." instance=ExtResource("11_ovphn")]
[node name="enemies" type="Node" parent="."]
[node name="badguy" parent="enemies" instance=ExtResource("11_ovphn")]
position = Vector2(179, 84)
[node name="badguy2" parent="enemies" instance=ExtResource("11_ovphn")]
position = Vector2(559, -46)
[node name="badguy3" parent="enemies" instance=ExtResource("11_ovphn")]
position = Vector2(-95, -78)
[node name="badguy4" parent="enemies" instance=ExtResource("11_ovphn")]
position = Vector2(419, -140)
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="UI" parent="CanvasLayer" instance=ExtResource("12_pvhor")]
[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"]

View File

@ -13,6 +13,9 @@ extends CharacterBody2D
@onready var animated_sprite = $AnimatedSprite2D
signal deathComplete
var currentPlaying = "idle"
var faceLeft = false
var pushLeftEnabled = false
var pushRightEnabled = false
@ -23,9 +26,10 @@ var bullet = preload("res://scenes/bullet.tscn")
# Get the gravity from the project settings to be synced with RigidBody nodes.
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):
@ -73,27 +77,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"):
@ -107,3 +111,8 @@ 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":
deathComplete.emit()

21
scripts/GameManager.gd Normal file
View File

@ -0,0 +1,21 @@
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, queer, get used to it!")
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
func _process(delta):
pass

View File

@ -1,4 +1,4 @@
extends Area2D
class_name BadGuy extends Area2D
const speed = 60
var direction = 1
@ -7,7 +7,9 @@ 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():
@ -34,7 +36,6 @@ func _process(delta):
func _on_body_entered(body):
print("something hit the bad guy")
if body.is_in_group("player"):
game.playerDeath()
playerDamage.emit()

View File

@ -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()

View File

@ -4,18 +4,24 @@ 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.
# Called every frame. 'delta' is the elapsed time since the previous frame.
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)
func _process(delta):
pass
if GameManager.player.health <= 0 && player.living:
player.die()
func _on_area_2d_areatrigger(effect, body):
@ -31,12 +37,21 @@ func _on_area_2d_areatrigger(effect, body):
box.position = box_trap.position
"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.coinUpdate(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)

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

View File

@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="Character" load_steps=2 format=3 uid="uid://c0n0yean36qm3"]
[ext_resource type="Script" path="res://scripts/resources/character_stats.gd" id="1_q0ae6"]
[resource]
script = ExtResource("1_q0ae6")
max_health = 100
starting_health = 100
health = 100

View File

@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="Character" load_steps=2 format=3 uid="uid://dbn3ku6rpqrbh"]
[ext_resource type="Script" path="res://scripts/resources/character_stats.gd" id="1_1s65d"]
[resource]
script = ExtResource("1_1s65d")
max_health = 50
starting_health = 50
health = 50

11
scripts/ui.gd Normal file
View File

@ -0,0 +1,11 @@
extends Control
@onready var health = $VBoxContainer/HBoxContainer/MarginContainer/Health
@onready var coins = $VBoxContainer/HBoxContainer/MarginContainer2/Coins
func _ready():
coinUpdate(GameManager.coinCollectedTotal)
healthUpdate(GameManager.player.health)
func healthUpdate(amt):
health.text = "Health : "+str(amt)
func coinUpdate(amt):
coins.text = "Coins : "+str(amt)