bad guy movement, player death, ui with health, timer, coins, added a dictionary for bad guys

This commit is contained in:
OddlyTimbot 2025-03-31 21:07:37 -04:00
parent 31d586b386
commit c111513980
18 changed files with 466 additions and 52 deletions

Binary file not shown.

View File

@ -0,0 +1,34 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://ck82hbpdi43wo"
path="res://.godot/imported/PixelOperator8-Bold.ttf-74faf550739674ad3170f08e646e0614.fontdata"
[deps]
source_file="res://assets/fonts/PixelOperator8-Bold.ttf"
dest_files=["res://.godot/imported/PixelOperator8-Bold.ttf-74faf550739674ad3170f08e646e0614.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

Binary file not shown.

View File

@ -0,0 +1,34 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://dob7f4ij0rf08"
path="res://.godot/imported/PixelOperator8.ttf-6f9f01766aff16f52046b880ffb8d367.fontdata"
[deps]
source_file="res://assets/fonts/PixelOperator8.ttf"
dest_files=["res://.godot/imported/PixelOperator8.ttf-6f9f01766aff16f52046b880ffb8d367.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b24rf6ib3rff2"
path="res://.godot/imported/Player Death 64x64.png-0c6ff54e7d9aad74b66dce47376541f8.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/player/death/Player Death 64x64.png"
dest_files=["res://.godot/imported/Player Death 64x64.png-0c6ff54e7d9aad74b66dce47376541f8.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

@ -1,4 +1,4 @@
[gd_scene load_steps=23 format=4 uid="uid://bt6uaac8wfn8k"]
[gd_scene load_steps=24 format=4 uid="uid://bt6uaac8wfn8k"]
[ext_resource type="Texture2D" uid="uid://b864327g3sfgt" path="res://assets/graphics/backgrounds/block.png" id="2_05t6n"]
[ext_resource type="Texture2D" uid="uid://dceuefsnvb441" path="res://assets/graphics/terrains/Terrain (32x32) (1).png" id="2_k4vve"]
@ -14,6 +14,7 @@
[ext_resource type="Script" path="res://scripts/scene_manager.gd" id="5_xhw0f"]
[ext_resource type="PackedScene" uid="uid://meryvmptc54n" path="res://scenes/coin.tscn" id="13_vf7vr"]
[ext_resource type="PackedScene" uid="uid://c3blwnpwdol0a" path="res://scenes/slime.tscn" id="14_nv7k0"]
[ext_resource type="PackedScene" uid="uid://bcqdlw160sfya" path="res://scenes/ui.tscn" id="15_l2yfp"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ud57a"]
texture = ExtResource("2_k4vve")
@ -433,7 +434,7 @@ texture = ExtResource("5_4ta71")
[node name="TileMapLayer" type="TileMapLayer" parent="."]
texture_filter = 1
tile_map_data = PackedByteArray("AAAHAA8AAQAAAAQAAAAIAA8AAQABAAQAAAAJAA8AAQABAAQAAAAKAA8AAQABAAQAAAALAA8AAQABAAQAAAAMAA8AAQABAAQAAAANAA8AAQABAAQAAAAOAA8A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QABAAQAAAAQAA0AAQACAAQAAAAVAA0AAQAAAAQAAAAWAA0AAQACAAQAAAAYAA0AAQAAAAQAAAAZAA0AAQABAAQAAAAaAA0AAQACAAQAAAAWAAsAAQAAAAQAAAAXAAsAAQAQAAQAAAAXAAoAAQAPAAMAAAAYAAoAAQAQAAQAAAAYAAkAAQAEAAAAAAASAAsAAgAAAAAAAAAYAAwAAgAAAAAAAAAZAAwAAgAAAAAAAAAaAAwAAgAAAAAAAAAOAAwAAwAAAAEAAAAOAAsAAwAAAAAAAAAYAAgAAgAAAAAAAAAcAA4AAwAAAAEAAAAcAA0AAwAAAAAAAAAXAA4AAQAEAAAAAAAIAA4AAQAEAAAAAAA=")
tile_set = SubResource("TileSet_dj74p")
[node name="StaticBody2D" type="StaticBody2D" parent="."]
@ -515,3 +516,10 @@ position = Vector2(814, 411)
[node name="Area2D" parent="badguys" instance=ExtResource("14_nv7k0")]
position = Vector2(562, 469)
[node name="Area2D2" parent="badguys" instance=ExtResource("14_nv7k0")]
position = Vector2(673, 469)
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="ui" parent="CanvasLayer" instance=ExtResource("15_l2yfp")]

View File

@ -1,6 +1,5 @@
[gd_scene load_steps=22 format=4 uid="uid://bxnqbn4qfkh1y"]
[gd_scene load_steps=24 format=4 uid="uid://oarnel3sgfb6"]
[ext_resource type="Script" path="res://scripts/gamecontroller.gd" id="1_hkovx"]
[ext_resource type="Texture2D" uid="uid://b864327g3sfgt" path="res://assets/graphics/backgrounds/block.png" id="2_6yvgp"]
[ext_resource type="Texture2D" uid="uid://y3nls3jdessv" path="res://assets/graphics/backgrounds/forestbackground (2).png" id="3_ta1h5"]
[ext_resource type="Texture2D" uid="uid://cqsyqmn3x0krf" path="res://assets/graphics/backgrounds/shrubs.png" id="4_jq3sv"]
@ -12,7 +11,10 @@
[ext_resource type="Script" path="res://scripts/crate.gd" id="10_b1chu"]
[ext_resource type="PackedScene" uid="uid://cjvyslsoa7olc" path="res://scenes/player.tscn" id="11_vaibk"]
[ext_resource type="Script" path="res://scripts/scene_manager.gd" id="12_dk1wg"]
[ext_resource type="PackedScene" uid="uid://meryvmptc54n" path="res://scenes/coin.tscn" id="13_hrpwr"]
[ext_resource type="PackedScene" uid="uid://bibqnht5dooss" path="res://scenes/trigger.tscn" id="13_kdnhf"]
[ext_resource type="PackedScene" uid="uid://c3blwnpwdol0a" path="res://scenes/slime.tscn" id="14_0te51"]
[ext_resource type="PackedScene" uid="uid://bcqdlw160sfya" path="res://scenes/ui.tscn" id="15_kkn1j"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ud57a"]
texture = ExtResource("6_yx2wt")
@ -396,7 +398,6 @@ size = Vector2(72, 20)
size = Vector2(20, 40)
[node name="Game" type="Node2D"]
script = ExtResource("1_hkovx")
[node name="sky" type="Parallax2D" parent="."]
repeat_size = Vector2(320, 180)
@ -433,7 +434,7 @@ texture = ExtResource("5_vocq4")
[node name="TileMapLayer" type="TileMapLayer" parent="."]
texture_filter = 1
tile_map_data = PackedByteArray("AAAHAA8AAQAAAAQAAAAIAA8AAQABAAQAAAAJAA8AAQABAAQAAAAKAA8AAQABAAQAAAALAA8AAQABAAQAAAAMAA8AAQABAAQAAAANAA8AAQABAAQAAAAOAA8AAQABAAQAAAAPAA8AAQABAAQAAAAQAA8AAQABAAQAAAARAA8AAQABAAQAAAASAA8AAQABAAQAAAATAA8AAQABAAQAAAAUAA8AAQABAAQAAAAVAA8AAQABAAQAAAAWAA8AAQABAAQAAAAXAA8AAQABAAQAAAAYAA8AAQABAAQAAAAZAA8AAQABAAQAAAAaAA8AAQABAAQAAAAbAA8AAQABAAQAAAAcAA8AAQABAAQAAAAdAA8AAQABAAQAAAAeAA8AAQACAAQAAAASAAwAAQAEAAQAAAAVAA0AAQAAAAQAAAAWAA0AAQACAAQAAAAYAA0AAQAAAAQAAAAZAA0AAQABAAQAAAAaAA0AAQACAAQAAAAWAAsAAQAAAAQAAAAXAAsAAQAQAAQAAAAXAA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AQACAAQAAAAVAA0AAQAAAAQAAAAWAA0AAQACAAQAAAAYAA0AAQAAAAQAAAAZAA0AAQABAAQAAAAaAA0AAQACAAQAAAAWAAsAAQAAAAQAAAAXAAsAAQAQAAQAAAAXAAoAAQAPAAMAAAAYAAoAAQAQAAQAAAAYAAkAAQAEAAAAAAASAAsAAgAAAAAAAAAYAAwAAgAAAAAAAAAZAAwAAgAAAAAAAAAaAAwAAgAAAAAAAAAOAAwAAwAAAAEAAAAOAAsAAwAAAAAAAAAYAAgAAgAAAAAAAAAcAA4AAwAAAAEAAAAcAA0AAwAAAAAAAAAXAA4AAQAEAAAAAAAIAA4AAQAEAAAAAAA=")
tile_set = SubResource("TileSet_dj74p")
[node name="StaticBody2D" type="StaticBody2D" parent="."]
@ -455,13 +456,17 @@ shape = SubResource("RectangleShape2D_ggdp1")
[node name="crates" type="Node2D" parent="."]
[node name="crate1" parent="crates" instance=ExtResource("9_c3hao")]
position = Vector2(481, 369)
script = ExtResource("10_b1chu")
[node name="crate2" parent="crates" instance=ExtResource("9_c3hao")]
position = Vector2(534, 397)
rotation = 0.380482
script = ExtResource("10_b1chu")
[node name="crate4" parent="crates" instance=ExtResource("9_c3hao")]
position = Vector2(444, 233)
position = Vector2(683, 338)
rotation = 0.380482
script = ExtResource("10_b1chu")
@ -471,7 +476,7 @@ rotation = -0.760964
script = ExtResource("10_b1chu")
[node name="CharacterBody2D" parent="." instance=ExtResource("11_vaibk")]
position = Vector2(274, 359)
position = Vector2(586, 347)
[node name="SceneManager" type="Node" parent="."]
unique_name_in_owner = true
@ -480,6 +485,7 @@ script = ExtResource("12_dk1wg")
[node name="triggers" type="Node2D" parent="."]
[node name="Trigger" parent="triggers" instance=ExtResource("13_kdnhf")]
position = Vector2(697, 465)
effect = "destroy"
[node name="CollisionShape2D" type="CollisionShape2D" parent="triggers/Trigger"]
@ -494,3 +500,26 @@ effect = "powerup"
position = Vector2(0, -10)
shape = SubResource("RectangleShape2D_1ymsv")
debug_color = Color(0.156093, 0.622347, 0.484765, 0.42)
[node name="coins" type="Node2D" parent="."]
[node name="Area2D" parent="coins" instance=ExtResource("13_hrpwr")]
position = Vector2(616, 455)
[node name="Area2D2" parent="coins" instance=ExtResource("13_hrpwr")]
position = Vector2(685, 411)
[node name="Area2D3" parent="coins" instance=ExtResource("13_hrpwr")]
position = Vector2(814, 411)
[node name="badguys" type="Node2D" parent="."]
[node name="Area2D" parent="badguys" instance=ExtResource("14_0te51")]
position = Vector2(562, 469)
[node name="Area2D2" parent="badguys" instance=ExtResource("14_0te51")]
position = Vector2(673, 469)
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="ui" parent="CanvasLayer" instance=ExtResource("15_kkn1j")]

View File

@ -1,20 +1,23 @@
[gd_scene load_steps=21 format=4 uid="uid://cce26eq3etcdg"]
[gd_scene load_steps=24 format=4 uid="uid://cth6ipw7nqgjl"]
[ext_resource type="Texture2D" uid="uid://b864327g3sfgt" path="res://assets/graphics/backgrounds/block.png" id="1_i0nwn"]
[ext_resource type="Texture2D" uid="uid://y3nls3jdessv" path="res://assets/graphics/backgrounds/forestbackground (2).png" id="2_6ftlp"]
[ext_resource type="Texture2D" uid="uid://cqsyqmn3x0krf" path="res://assets/graphics/backgrounds/shrubs.png" id="3_34sir"]
[ext_resource type="Texture2D" uid="uid://bkmaqkvirjxs3" path="res://assets/graphics/backgrounds/rocks.png" id="4_o62em"]
[ext_resource type="Texture2D" uid="uid://dceuefsnvb441" path="res://assets/graphics/terrains/Terrain (32x32) (1).png" id="5_aabh3"]
[ext_resource type="Texture2D" uid="uid://crulrkd4r5bln" path="res://assets/graphics/terrains/veg_32x32.png" id="6_06xm0"]
[ext_resource type="Texture2D" uid="uid://bu6vmqioadmrh" path="res://assets/graphics/terrains/mushroom.png" id="7_61gcb"]
[ext_resource type="PackedScene" uid="uid://celwbq1syhdoa" path="res://scenes/crate.tscn" id="8_4axuh"]
[ext_resource type="Script" path="res://scripts/crate.gd" id="9_jwr41"]
[ext_resource type="PackedScene" uid="uid://cjvyslsoa7olc" path="res://scenes/player.tscn" id="10_poa8t"]
[ext_resource type="Script" path="res://scripts/scene_manager.gd" id="11_lvxwe"]
[ext_resource type="PackedScene" uid="uid://bibqnht5dooss" path="res://scenes/trigger.tscn" id="12_527fi"]
[ext_resource type="Texture2D" uid="uid://b864327g3sfgt" path="res://assets/graphics/backgrounds/block.png" id="1_hoceb"]
[ext_resource type="Texture2D" uid="uid://y3nls3jdessv" path="res://assets/graphics/backgrounds/forestbackground (2).png" id="2_clu6e"]
[ext_resource type="Texture2D" uid="uid://cqsyqmn3x0krf" path="res://assets/graphics/backgrounds/shrubs.png" id="3_87d56"]
[ext_resource type="Texture2D" uid="uid://bkmaqkvirjxs3" path="res://assets/graphics/backgrounds/rocks.png" id="4_q4i4b"]
[ext_resource type="Texture2D" uid="uid://dceuefsnvb441" path="res://assets/graphics/terrains/Terrain (32x32) (1).png" id="5_f2mjl"]
[ext_resource type="Texture2D" uid="uid://crulrkd4r5bln" path="res://assets/graphics/terrains/veg_32x32.png" id="6_i5u0a"]
[ext_resource type="Texture2D" uid="uid://bu6vmqioadmrh" path="res://assets/graphics/terrains/mushroom.png" id="7_pmr2j"]
[ext_resource type="PackedScene" uid="uid://celwbq1syhdoa" path="res://scenes/crate.tscn" id="8_8rx66"]
[ext_resource type="Script" path="res://scripts/crate.gd" id="9_msnkv"]
[ext_resource type="PackedScene" uid="uid://cjvyslsoa7olc" path="res://scenes/player.tscn" id="10_2yi8e"]
[ext_resource type="Script" path="res://scripts/scene_manager.gd" id="11_uo07j"]
[ext_resource type="PackedScene" uid="uid://bibqnht5dooss" path="res://scenes/trigger.tscn" id="12_unhmu"]
[ext_resource type="PackedScene" uid="uid://meryvmptc54n" path="res://scenes/coin.tscn" id="13_drr02"]
[ext_resource type="PackedScene" uid="uid://c3blwnpwdol0a" path="res://scenes/slime.tscn" id="14_87djp"]
[ext_resource type="PackedScene" uid="uid://bcqdlw160sfya" path="res://scenes/ui.tscn" id="15_3qtqs"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ud57a"]
texture = ExtResource("5_aabh3")
texture = ExtResource("5_f2mjl")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
0:0/0/terrain_set = 0
@ -353,14 +356,14 @@ texture_region_size = Vector2i(32, 32)
16:4/0/terrains_peering_bit/top_side = 0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_7tjg7"]
texture = ExtResource("6_06xm0")
texture = ExtResource("6_i5u0a")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
0:0/0/terrain_set = 0
0:0/0/terrain = 1
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_hir5y"]
texture = ExtResource("7_61gcb")
texture = ExtResource("7_pmr2j")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
0:0/0/terrain_set = 0
@ -402,7 +405,7 @@ metadata/_edit_group_ = true
[node name="Sprite2D" type="Sprite2D" parent="sky"]
position = Vector2(160, 90)
texture = ExtResource("1_i0nwn")
texture = ExtResource("1_hoceb")
[node name="farbg" type="Parallax2D" parent="."]
scroll_scale = Vector2(0.5, 1)
@ -411,7 +414,7 @@ metadata/_edit_group_ = true
[node name="Sprite2D" type="Sprite2D" parent="farbg"]
position = Vector2(160, 410)
texture = ExtResource("2_6ftlp")
texture = ExtResource("2_clu6e")
[node name="midground" type="Parallax2D" parent="."]
repeat_size = Vector2(320, 0)
@ -419,7 +422,7 @@ metadata/_edit_group_ = true
[node name="Sprite2D" type="Sprite2D" parent="midground"]
position = Vector2(160, 420)
texture = ExtResource("3_34sir")
texture = ExtResource("3_87d56")
[node name="foreground" type="Parallax2D" parent="."]
scroll_scale = Vector2(1.5, 1)
@ -427,11 +430,11 @@ repeat_size = Vector2(320, 0)
[node name="Sprite2D" type="Sprite2D" parent="foreground"]
position = Vector2(160, 420)
texture = ExtResource("4_o62em")
texture = ExtResource("4_q4i4b")
[node name="TileMapLayer" type="TileMapLayer" parent="."]
texture_filter = 1
tile_map_data = PackedByteAr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AAaAA8AAQABAAQAAAAbAA8AAQABAAQAAAAcAA8AAQABAAQAAAAdAA8AAQABAAQAAAAeAA8AAQACAAQAAAASAAwAAQAEAAQAAAAOAA0AAQAAAAQAAAAPAA0AAQABAAQAAAAQAA0AAQACAAQAAAAVAA0AAQAAAAQAAAAWAA0AAQACAAQAAAAYAA0AAQAAAAQAAAAZAA0AAQABAAQAAAAaAA0AAQACAAQAAAAWAAsAAQAAAAQAAAAXAAsAAQAQAAQAAAAXAAoAAQAPAAMAAAAYAAoAAQAQAAQAAAAYAAkAAQAEAAAAAAASAAsAAgAAAAAAAAAYAAwAAgAAAAAAAAAZAAwAAgAAAAAAAAAaAAwAAgAAAAAAAAAOAAwAAwAAAAEAAAAOAAsAAwAAAAAAAAAYAAgAAgAAAAAAAAAcAA4AAwAAAAEAAAAcAA0AAwAAAAAAAAAXAA4AAQAEAAAAAAAIAA4AAQAEAAAAAAA=")
tile_set = SubResource("TileSet_dj74p")
[node name="StaticBody2D" type="StaticBody2D" parent="."]
@ -453,35 +456,35 @@ shape = SubResource("RectangleShape2D_ggdp1")
[node name="crates" type="Node2D" parent="."]
[node name="crate1" parent="crates" instance=ExtResource("8_4axuh")]
[node name="crate1" parent="crates" instance=ExtResource("8_8rx66")]
position = Vector2(481, 369)
script = ExtResource("9_jwr41")
script = ExtResource("9_msnkv")
[node name="crate2" parent="crates" instance=ExtResource("8_4axuh")]
[node name="crate2" parent="crates" instance=ExtResource("8_8rx66")]
position = Vector2(534, 397)
rotation = 0.380482
script = ExtResource("9_jwr41")
script = ExtResource("9_msnkv")
[node name="crate4" parent="crates" instance=ExtResource("8_4axuh")]
position = Vector2(628, 345)
[node name="crate4" parent="crates" instance=ExtResource("8_8rx66")]
position = Vector2(683, 338)
rotation = 0.380482
script = ExtResource("9_jwr41")
script = ExtResource("9_msnkv")
[node name="crate3" parent="crates" instance=ExtResource("8_4axuh")]
[node name="crate3" parent="crates" instance=ExtResource("8_8rx66")]
position = Vector2(693, 255)
rotation = -0.760964
script = ExtResource("9_jwr41")
script = ExtResource("9_msnkv")
[node name="CharacterBody2D" parent="." instance=ExtResource("10_poa8t")]
[node name="CharacterBody2D" parent="." instance=ExtResource("10_2yi8e")]
position = Vector2(586, 347)
[node name="SceneManager" type="Node" parent="."]
unique_name_in_owner = true
script = ExtResource("11_lvxwe")
script = ExtResource("11_uo07j")
[node name="triggers" type="Node2D" parent="."]
[node name="Trigger" parent="triggers" instance=ExtResource("12_527fi")]
[node name="Trigger" parent="triggers" instance=ExtResource("12_unhmu")]
position = Vector2(697, 465)
effect = "destroy"
@ -489,7 +492,7 @@ effect = "destroy"
shape = SubResource("CircleShape2D_opmvx")
debug_color = Color(0.731092, 0.294274, 0.91724, 0.42)
[node name="powerup" parent="triggers" instance=ExtResource("12_527fi")]
[node name="powerup" parent="triggers" instance=ExtResource("12_unhmu")]
position = Vector2(791, 407)
effect = "powerup"
@ -497,3 +500,26 @@ effect = "powerup"
position = Vector2(0, -10)
shape = SubResource("RectangleShape2D_1ymsv")
debug_color = Color(0.156093, 0.622347, 0.484765, 0.42)
[node name="coins" type="Node2D" parent="."]
[node name="Area2D" parent="coins" instance=ExtResource("13_drr02")]
position = Vector2(616, 455)
[node name="Area2D2" parent="coins" instance=ExtResource("13_drr02")]
position = Vector2(685, 411)
[node name="Area2D3" parent="coins" instance=ExtResource("13_drr02")]
position = Vector2(814, 411)
[node name="badguys" type="Node2D" parent="."]
[node name="Area2D" parent="badguys" instance=ExtResource("14_87djp")]
position = Vector2(562, 469)
[node name="Area2D2" parent="badguys" instance=ExtResource("14_87djp")]
position = Vector2(673, 469)
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="ui" parent="CanvasLayer" instance=ExtResource("15_3qtqs")]

View File

@ -1,13 +1,54 @@
[gd_scene load_steps=33 format=3 uid="uid://cjvyslsoa7olc"]
[gd_scene load_steps=44 format=3 uid="uid://cjvyslsoa7olc"]
[ext_resource type="Script" path="res://scripts/player.gd" id="1_ffdhb"]
[ext_resource type="Texture2D" uid="uid://c8seclaqrgq6x" path="res://assets/graphics/player/hurt/Player Hurt 48x48.png" id="2_3u4bg"]
[ext_resource type="Texture2D" uid="uid://d6cdeej48ryk" path="res://assets/graphics/player/idle/Player Idle 48x48.png" id="2_ekybh"]
[ext_resource type="Texture2D" uid="uid://b24rf6ib3rff2" path="res://assets/graphics/player/death/Player Death 64x64.png" id="2_waoxy"]
[ext_resource type="Texture2D" uid="uid://bo4lwotnk3cs" path="res://assets/graphics/player/jump/player jump 48x48.png" id="3_fab18"]
[ext_resource type="Texture2D" uid="uid://dny0tvbhrt1jh" path="res://assets/graphics/player/run/player run 48x48.png" id="3_q7el6"]
[sub_resource type="CircleShape2D" id="CircleShape2D_q23dn"]
[sub_resource type="AtlasTexture" id="AtlasTexture_kpkpq"]
atlas = ExtResource("2_waoxy")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_ahiol"]
atlas = ExtResource("2_waoxy")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_wdm33"]
atlas = ExtResource("2_waoxy")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_82a4q"]
atlas = ExtResource("2_waoxy")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_40c0q"]
atlas = ExtResource("2_waoxy")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_nfamv"]
atlas = ExtResource("2_waoxy")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_idf1k"]
atlas = ExtResource("2_waoxy")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_dkoqg"]
atlas = ExtResource("2_waoxy")
region = Rect2(336, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_qm0b5"]
atlas = ExtResource("2_waoxy")
region = Rect2(384, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_bxmej"]
atlas = ExtResource("2_waoxy")
region = Rect2(432, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_40d3p"]
atlas = ExtResource("2_3u4bg")
region = Rect2(0, 0, 48, 48)
@ -112,6 +153,41 @@ region = Rect2(336, 0, 48, 48)
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_kpkpq")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ahiol")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wdm33")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_82a4q")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_40c0q")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_nfamv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_idf1k")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_dkoqg")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qm0b5")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_bxmej")
}],
"loop": false,
"name": &"death",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_40d3p")
}, {
"duration": 1.0,
@ -231,7 +307,7 @@ position = Vector2(-19, -9)
texture_filter = 1
position = Vector2(0, -7)
sprite_frames = SubResource("SpriteFrames_ok1w6")
animation = &"run"
animation = &"death"
autoplay = "hurt"
[node name="Camera2D" type="Camera2D" parent="."]

View File

@ -57,4 +57,18 @@ frame_progress = 0.906364
position = Vector2(0, 4.5)
shape = SubResource("RectangleShape2D_7ddlr")
[node name="rightCast" type="RayCast2D" parent="."]
target_position = Vector2(13, 0)
[node name="leftCast" type="RayCast2D" parent="."]
target_position = Vector2(-13, 0)
[node name="rightCastFloor" type="RayCast2D" parent="."]
position = Vector2(7, 1)
target_position = Vector2(0, 13)
[node name="leftCastFloor" type="RayCast2D" parent="."]
position = Vector2(-7, 0)
target_position = Vector2(0, 14)
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

View File

@ -0,0 +1,70 @@
[gd_scene load_steps=5 format=3 uid="uid://bcqdlw160sfya"]
[ext_resource type="FontFile" uid="uid://dob7f4ij0rf08" path="res://assets/fonts/PixelOperator8.ttf" id="1_c264r"]
[ext_resource type="Script" path="res://scripts/ui.gd" id="1_epn5m"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_c3kbs"]
bg_color = Color(0.133933, 0.132914, 0.00574836, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_vga6l"]
bg_color = Color(0.483969, 0.669562, 0.199093, 1)
[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_epn5m")
[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="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/HBoxContainer/MarginContainer"]
layout_mode = 2
[node name="health" type="Label" parent="VBoxContainer/HBoxContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_fonts/font = ExtResource("1_c264r")
theme_override_font_sizes/font_size = 8
text = "Health"
[node name="healthProgress" type="ProgressBar" parent="VBoxContainer/HBoxContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_styles/background = SubResource("StyleBoxFlat_c3kbs")
theme_override_styles/fill = SubResource("StyleBoxFlat_vga6l")
show_percentage = false
[node name="MarginContainer2" type="MarginContainer" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="timer" type="Label" parent="VBoxContainer/HBoxContainer/MarginContainer2"]
layout_mode = 2
theme_override_fonts/font = ExtResource("1_c264r")
theme_override_font_sizes/font_size = 8
text = "timer"
horizontal_alignment = 1
[node name="MarginContainer3" type="MarginContainer" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="coins" type="Label" parent="VBoxContainer/HBoxContainer/MarginContainer3"]
texture_filter = 1
layout_mode = 2
theme_override_fonts/font = ExtResource("1_c264r")
theme_override_font_sizes/font_size = 8
text = "coins"
horizontal_alignment = 2

View File

@ -10,7 +10,11 @@ var enemies = 0
signal destroySignal(body)
signal levelCompleteSignal(level)
signal playerHurtSignal(healthRemaining)
signal playerHurtSignal(healthRemaining, maxHealth)
signal playerKillSignal
signal timerUpdateSignal(timeRemaining, totalTimeForLevel)
signal coinUpdateSignal(coinsCollectedTotal, coinsAvailableTotal)
#level info
var timer:= Timer.new()
var levels = ["res://scenes/game.tscn","res://scenes/level2.tscn","res://scenes/level3.tscn"]
@ -21,6 +25,8 @@ var countdown=0
var player:Resource
var slime:Resource
var enemiesDict={}
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
player = load("res://scripts/res/playerStats.tres")
@ -34,9 +40,12 @@ func _ready() -> void:
timer.start()
func reset():
countdown = timers[currentLevel]
player.health = player.max_health
coinsCollected = 0
func secondCounter():
countdown -=1
timerUpdateSignal.emit(countdown, timers[currentLevel])
if countdown <=0:
print("YOU LOSE")
levelCompleteSignal.emit(levels[currentLevel])
@ -82,17 +91,31 @@ func coinCollected(body, coin):
if body is Player:
#increase coins collected count
coinsCollected +=1
coinUpdateSignal.emit(coinsCollected, totalCoinsAvailable)
destroySignal.emit(coin)
func playerDamage(body, badguy):
if body is Player:
print("GC knows player taking damage")
print("Player health "+str(player.health)+" takes damage "+str(slime.meleeDamage))
player.health -= slime.meleeDamage
player.health -= enemiesDict[badguy]["damage"]
if player.health > 0:
playerHurtSignal.emit(player.health)
playerHurtSignal.emit(player.health, player.max_health)
else:
print("kill em")
playerKillSignal.emit()
print(enemiesDict[badguy]["health"])
func addBadGuy(enemy):
print("adding an enemy")
#use a dictionary
var enemyStats = {
"health": slime.health,
"damage": slime.meleeDamage
}
enemiesDict[enemy] = enemyStats
func numberOfBadguys(value):
enemies = value
func deathComplete():
print("GC knows death is complete")
levelCompleteSignal.emit(levels[currentLevel])

View File

@ -20,6 +20,8 @@ var isJumping = false
var animPlaying = "idle"
var living = true
signal deathCompleteSignal
func _physics_process(delta: float) -> void:
if living and not animPlaying == "hurt":
@ -99,8 +101,14 @@ func hurtPlayer(health):
print("Player takes damage, health remaining:: "+str(health))
animPlaying = "hurt"
playerGraphic.play(animPlaying)
func killPlayer():
print("Kill the player")
living = false
animPlaying="death"
playerGraphic.play(animPlaying)
func _on_animation_finished() -> void:
if animPlaying=="hurt":
animPlaying=="idle"
animPlaying="idle"
if animPlaying=="death":
deathCompleteSignal.emit()

View File

@ -7,5 +7,5 @@ script = ExtResource("1_ev6pb")
max_health = 50
starting_health = 50
health = 50
meleeDamage = 30
meleeDamage = 5
rangeDamage = 0

View File

@ -5,6 +5,7 @@ extends Node
@onready var coins: Node2D = $"../coins"
@onready var badguys: Node2D = $"../badguys"
@onready var player: Player = $"../CharacterBody2D"
@onready var ui: Control = $"../CanvasLayer/ui"
var bulletsFiredTotal = 0
var bulletsMadeTotal = 0
@ -66,6 +67,7 @@ func buildLevel():
if obj is Slime:
totalBadguys +=1
obj.playerDamageSignal.connect(Gamecontroller.playerDamage)
Gamecontroller.addBadGuy(obj)
Gamecontroller.numberOfBadguys(totalBadguys)
#wire up the triggers
for obj in triggers.get_children():
@ -77,6 +79,12 @@ func buildLevel():
Gamecontroller.destroySignal.connect(destroy)
Gamecontroller.levelCompleteSignal.connect(loadLevel)
Gamecontroller.playerHurtSignal.connect(playerHurt)
Gamecontroller.playerHurtSignal.connect(ui.healthUpdate)
Gamecontroller.playerKillSignal.connect(playerKill)
Gamecontroller.timerUpdateSignal.connect(ui.timerUpdate)
Gamecontroller.coinUpdateSignal.connect(ui.coinsUpdate)
#listen to player
player.deathCompleteSignal.connect(Gamecontroller.deathComplete)
func loadLevel(level):
get_tree().change_scene_to_file(level)
@ -84,5 +92,7 @@ func loadLevel(level):
func _ready() -> void:
buildLevel()
Gamecontroller.reset()
func playerHurt(health):
func playerHurt(health, _maxHealth):
player.hurtPlayer(health)
func playerKill():
player.killPlayer()

View File

@ -1,7 +1,31 @@
class_name Slime extends Area2D
signal playerDamageSignal
@onready var right_cast: RayCast2D = $rightCast
@onready var left_cast: RayCast2D = $leftCast
@onready var right_cast_floor: RayCast2D = $rightCastFloor
@onready var left_cast_floor: RayCast2D = $leftCastFloor
var speed = 100
var direction = 1
func _process(delta: float) -> void:
if not right_cast_floor.is_colliding():
direction = -1
if not left_cast_floor.is_colliding():
direction = 1
if right_cast.is_colliding():
var body = right_cast.get_collider()
if not body is Player:
direction = -1
if left_cast.is_colliding():
var body = left_cast.get_collider()
if not body is Player:
direction = 1
position.x += direction * speed * delta
func _on_body_entered(body: Node2D) -> void:
print("Bad guy contact")
playerDamageSignal.emit(body, self)

View File

@ -0,0 +1,24 @@
extends Control
@onready var timer: Label = $VBoxContainer/HBoxContainer/MarginContainer2/timer
@onready var coins: Label = $VBoxContainer/HBoxContainer/MarginContainer3/coins
@onready var health: Label = $VBoxContainer/HBoxContainer/MarginContainer/VBoxContainer/health
@onready var health_progress: ProgressBar = $VBoxContainer/HBoxContainer/MarginContainer/VBoxContainer/healthProgress
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
health.text="HEALTH"
timer.text="TIMER"
coins.text="COINS"
func healthUpdate(currentHealth, maxHealth):
print( float(currentHealth) / maxHealth * 100)
health.text = "Health: "+str(currentHealth)+" of "+str(maxHealth)
health_progress.value = float(currentHealth) / maxHealth * 100
func timerUpdate(timeRemaining, _timeAvailable):
timer.text = "Time: "+str(timeRemaining)
func coinsUpdate(coinsCollected, coinsAvailable):
print(coinsCollected, coinsAvailable)
coins.text = "Coins: "+str(coinsCollected)+" of "+str(coinsAvailable)