player damage, player death, bad guy dictionary, bad guy damage, bad guy death, ui, player damage animation, player death animation

This commit is contained in:
AutumnMayes 2025-07-07 21:01:52 -04:00
parent 92e989c331
commit c10beb5635
22 changed files with 397 additions and 29 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://35h3pfqene6g"
path="res://.godot/imported/Player Death 64x64.png-585c61faad3b9e1142f9ebaa962a0235.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-585c61faad3b9e1142f9ebaa962a0235.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://npog4kgvtnlo"
path="res://.godot/imported/Player Hurt 48x48.png-4208d9781d587849c96afac76e871808.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Graphics/Player/Hurt/Player Hurt 48x48.png"
dest_files=["res://.godot/imported/Player Hurt 48x48.png-4208d9781d587849c96afac76e871808.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,16 +1,74 @@
[gd_scene load_steps=28 format=3 uid="uid://bu8e4iyw8pc03"] [gd_scene load_steps=44 format=3 uid="uid://bu8e4iyw8pc03"]
[ext_resource type="Script" uid="uid://dsryf6gxqcm1k" path="res://Scripts/character_body_2d.gd" id="1_0y7nr"] [ext_resource type="Script" uid="uid://dsryf6gxqcm1k" path="res://Scripts/character_body_2d.gd" id="1_0y7nr"]
[ext_resource type="Texture2D" uid="uid://dpv7hte6i8kui" path="res://Assets/Graphics/Player/Jump/player jump 48x48.png" id="2_dewec"] [ext_resource type="Texture2D" uid="uid://dpv7hte6i8kui" path="res://Assets/Graphics/Player/Jump/player jump 48x48.png" id="2_dewec"]
[ext_resource type="Texture2D" uid="uid://dl452cit6hmxl" path="res://Assets/Graphics/Player/Idle/Player Idle 48x48.png" id="2_kyqiw"] [ext_resource type="Texture2D" uid="uid://dl452cit6hmxl" path="res://Assets/Graphics/Player/Idle/Player Idle 48x48.png" id="2_kyqiw"]
[ext_resource type="Texture2D" uid="uid://35h3pfqene6g" path="res://Assets/Graphics/Player/Death/Player Death 64x64.png" id="2_nn08x"]
[ext_resource type="Texture2D" uid="uid://bmrxpbm2roq7s" path="res://Assets/Graphics/Player/Run/player run 48x48.png" id="3_gntrk"] [ext_resource type="Texture2D" uid="uid://bmrxpbm2roq7s" path="res://Assets/Graphics/Player/Run/player run 48x48.png" id="3_gntrk"]
[ext_resource type="Texture2D" uid="uid://npog4kgvtnlo" path="res://Assets/Graphics/Player/Hurt/Player Hurt 48x48.png" id="4_52ee3"]
[sub_resource type="CircleShape2D" id="CircleShape2D_2poj3"] [sub_resource type="CircleShape2D" id="CircleShape2D_2poj3"]
[sub_resource type="AtlasTexture" id="AtlasTexture_qidb7"]
atlas = ExtResource("2_nn08x")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_70hv0"]
atlas = ExtResource("2_nn08x")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_8flut"]
atlas = ExtResource("2_nn08x")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_u7x0b"]
atlas = ExtResource("2_nn08x")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_utwlt"]
atlas = ExtResource("2_nn08x")
region = Rect2(192, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_kih0c"]
atlas = ExtResource("2_nn08x")
region = Rect2(240, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_lyrkg"]
atlas = ExtResource("2_nn08x")
region = Rect2(288, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_c43xd"]
atlas = ExtResource("2_nn08x")
region = Rect2(336, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_avx33"]
atlas = ExtResource("2_nn08x")
region = Rect2(384, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_rxg2u"]
atlas = ExtResource("2_nn08x")
region = Rect2(432, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_5v66d"] [sub_resource type="AtlasTexture" id="AtlasTexture_5v66d"]
atlas = ExtResource("2_dewec") atlas = ExtResource("2_dewec")
region = Rect2(96, 0, 48, 48) region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_xixlo"]
atlas = ExtResource("4_52ee3")
region = Rect2(0, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_bfbt0"]
atlas = ExtResource("4_52ee3")
region = Rect2(48, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_wosd6"]
atlas = ExtResource("4_52ee3")
region = Rect2(96, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_hkrn1"]
atlas = ExtResource("4_52ee3")
region = Rect2(144, 0, 48, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_gntrk"] [sub_resource type="AtlasTexture" id="AtlasTexture_gntrk"]
atlas = ExtResource("2_kyqiw") atlas = ExtResource("2_kyqiw")
region = Rect2(0, 0, 48, 48) region = Rect2(0, 0, 48, 48)
@ -95,6 +153,41 @@ region = Rect2(336, 0, 48, 48)
animations = [{ animations = [{
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_qidb7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_70hv0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8flut")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_u7x0b")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_utwlt")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kih0c")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_lyrkg")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_c43xd")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_avx33")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rxg2u")
}],
"loop": false,
"name": &"death",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_5v66d") "texture": SubResource("AtlasTexture_5v66d")
}], }],
"loop": true, "loop": true,
@ -103,6 +196,23 @@ animations = [{
}, { }, {
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_xixlo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_bfbt0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wosd6")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_hkrn1")
}],
"loop": false,
"name": &"hurt",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_gntrk") "texture": SubResource("AtlasTexture_gntrk")
}, { }, {
"duration": 1.0, "duration": 1.0,
@ -178,6 +288,7 @@ animations = [{
}] }]
[node name="CharacterBody2D" type="CharacterBody2D"] [node name="CharacterBody2D" type="CharacterBody2D"]
position = Vector2(2, -1)
script = ExtResource("1_0y7nr") script = ExtResource("1_0y7nr")
metadata/_edit_group_ = true metadata/_edit_group_ = true
@ -192,16 +303,16 @@ target_position = Vector2(16, 0)
target_position = Vector2(-16, 0) target_position = Vector2(-16, 0)
[node name="RightSpawn" type="Node2D" parent="."] [node name="RightSpawn" type="Node2D" parent="."]
position = Vector2(17, -8) position = Vector2(17, -3)
[node name="LeftSpawn" type="Node2D" parent="."] [node name="LeftSpawn" type="Node2D" parent="."]
position = Vector2(-14, -9) position = Vector2(-14, -3)
[node name="PlayerGraphic" type="AnimatedSprite2D" parent="."] [node name="PlayerGraphic" type="AnimatedSprite2D" parent="."]
texture_filter = 1 texture_filter = 1
position = Vector2(0, -6) position = Vector2(0, -6)
sprite_frames = SubResource("SpriteFrames_miouo") sprite_frames = SubResource("SpriteFrames_miouo")
animation = &"falling" animation = &"hurt"
autoplay = "idle" autoplay = "idle"
[node name="Camera2D" type="Camera2D" parent="."] [node name="Camera2D" type="Camera2D" parent="."]

View File

@ -21,3 +21,5 @@ texture_filter = 1
position = Vector2(0.5, 0) position = Vector2(0.5, 0)
shape = SubResource("RectangleShape2D_oduel") shape = SubResource("RectangleShape2D_oduel")
debug_color = Color(0.995859, 0, 0.197667, 0.42) debug_color = Color(0.995859, 0, 0.197667, 0.42)
[connection signal="area_entered" from="." to="." method="_on_area_entered"]

View File

@ -1,10 +1,12 @@
[gd_scene load_steps=3 format=3 uid="uid://cd7fv3pwgr880"] [gd_scene load_steps=4 format=3 uid="uid://cd7fv3pwgr880"]
[ext_resource type="Script" uid="uid://b546t5rmhjwiu" path="res://Scripts/crate.gd" id="1_i4r3v"]
[ext_resource type="Texture2D" uid="uid://m685ffchmchr" path="res://Assets/Graphics/Objects/crate.png" id="1_wp72f"] [ext_resource type="Texture2D" uid="uid://m685ffchmchr" path="res://Assets/Graphics/Objects/crate.png" id="1_wp72f"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ebmjs"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_ebmjs"]
[node name="RigidBody2D3" type="RigidBody2D"] [node name="RigidBody2D3" type="RigidBody2D"]
script = ExtResource("1_i4r3v")
metadata/_edit_group_ = true metadata/_edit_group_ = true
[node name="Sprite2D" type="Sprite2D" parent="."] [node name="Sprite2D" type="Sprite2D" parent="."]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=4 uid="uid://c6mxse0hqjro7"] [gd_scene load_steps=19 format=4 uid="uid://c6mxse0hqjro7"]
[ext_resource type="Texture2D" uid="uid://mfcyrgamj3cc" path="res://Assets/Graphics/Terrains/Terrain (32x32).png" id="2_1l0tm"] [ext_resource type="Texture2D" uid="uid://mfcyrgamj3cc" path="res://Assets/Graphics/Terrains/Terrain (32x32).png" id="2_1l0tm"]
[ext_resource type="Script" uid="uid://bs4frobn6kxne" path="res://Scripts/scene_manager.gd" id="2_i6g32"] [ext_resource type="Script" uid="uid://bs4frobn6kxne" path="res://Scripts/scene_manager.gd" id="2_i6g32"]
@ -12,6 +12,7 @@
[ext_resource type="PackedScene" uid="uid://b5d8himq5sttt" path="res://Scenes/trigger.tscn" id="4_wowpa"] [ext_resource type="PackedScene" uid="uid://b5d8himq5sttt" path="res://Scenes/trigger.tscn" id="4_wowpa"]
[ext_resource type="PackedScene" uid="uid://cat3n1unb05u6" path="res://Scenes/slime.tscn" id="12_rfjv2"] [ext_resource type="PackedScene" uid="uid://cat3n1unb05u6" path="res://Scenes/slime.tscn" id="12_rfjv2"]
[ext_resource type="PackedScene" uid="uid://dr1mp5x0cmbhw" path="res://Scenes/coin.tscn" id="12_rku1e"] [ext_resource type="PackedScene" uid="uid://dr1mp5x0cmbhw" path="res://Scenes/coin.tscn" id="12_rku1e"]
[ext_resource type="PackedScene" uid="uid://k42k25w6fsbo" path="res://Scenes/ui.tscn" id="13_rfjv2"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_v158k"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_v158k"]
texture = ExtResource("2_1l0tm") texture = ExtResource("2_1l0tm")
@ -488,8 +489,15 @@ position = Vector2(483, 365)
[node name="Enemies" type="Node2D" parent="."] [node name="Enemies" type="Node2D" parent="."]
[node name="Slime2" parent="Enemies" instance=ExtResource("12_rfjv2")]
position = Vector2(275, 370)
[node name="Slime" parent="Enemies" instance=ExtResource("12_rfjv2")] [node name="Slime" parent="Enemies" instance=ExtResource("12_rfjv2")]
position = Vector2(641, 340) position = Vector2(641, 340)
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="UI" parent="CanvasLayer" instance=ExtResource("13_rfjv2")]
[connection signal="areatrigger" from="Triggers/Area2D2" to="." method="_on_areatrigger"] [connection signal="areatrigger" from="Triggers/Area2D2" to="." method="_on_areatrigger"]
[connection signal="areatrigger" from="Triggers/Area2D3" to="." method="_on_areatrigger"] [connection signal="areatrigger" from="Triggers/Area2D3" to="." method="_on_areatrigger"]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=4 uid="uid://bcray1583u4e6"] [gd_scene load_steps=18 format=4 uid="uid://bcray1583u4e6"]
[ext_resource type="Texture2D" uid="uid://c0aoaemjratj1" path="res://Assets/Graphics/Terrains/forestsky.png" id="1_mtqcm"] [ext_resource type="Texture2D" uid="uid://c0aoaemjratj1" path="res://Assets/Graphics/Terrains/forestsky.png" id="1_mtqcm"]
[ext_resource type="Texture2D" uid="uid://cugs4plceapu2" path="res://Assets/Graphics/Terrains/forestbackground.png" id="2_mmf1u"] [ext_resource type="Texture2D" uid="uid://cugs4plceapu2" path="res://Assets/Graphics/Terrains/forestbackground.png" id="2_mmf1u"]
@ -11,6 +11,7 @@
[ext_resource type="PackedScene" uid="uid://cd7fv3pwgr880" path="res://Scenes/crate.tscn" id="9_051s1"] [ext_resource type="PackedScene" uid="uid://cd7fv3pwgr880" path="res://Scenes/crate.tscn" id="9_051s1"]
[ext_resource type="PackedScene" uid="uid://b5d8himq5sttt" path="res://Scenes/trigger.tscn" id="10_in4v8"] [ext_resource type="PackedScene" uid="uid://b5d8himq5sttt" path="res://Scenes/trigger.tscn" id="10_in4v8"]
[ext_resource type="PackedScene" uid="uid://dr1mp5x0cmbhw" path="res://Scenes/coin.tscn" id="11_mu7lp"] [ext_resource type="PackedScene" uid="uid://dr1mp5x0cmbhw" path="res://Scenes/coin.tscn" id="11_mu7lp"]
[ext_resource type="PackedScene" uid="uid://k42k25w6fsbo" path="res://Scenes/ui.tscn" id="12_mmf1u"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_v158k"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_v158k"]
texture = ExtResource("4_r8hce") texture = ExtResource("4_r8hce")
@ -486,5 +487,9 @@ position = Vector2(952, 174)
[node name="Enemies" type="Node2D" parent="."] [node name="Enemies" type="Node2D" parent="."]
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="UI" parent="CanvasLayer" instance=ExtResource("12_mmf1u")]
[connection signal="areatrigger" from="Triggers/Area2D2" to="." method="_on_areatrigger"] [connection signal="areatrigger" from="Triggers/Area2D2" to="." method="_on_areatrigger"]
[connection signal="areatrigger" from="Triggers/Area2D3" to="." method="_on_areatrigger"] [connection signal="areatrigger" from="Triggers/Area2D3" to="." method="_on_areatrigger"]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=4 uid="uid://kqvn8jpvyrej"] [gd_scene load_steps=18 format=4 uid="uid://kqvn8jpvyrej"]
[ext_resource type="Texture2D" uid="uid://c0aoaemjratj1" path="res://Assets/Graphics/Terrains/forestsky.png" id="1_h6p24"] [ext_resource type="Texture2D" uid="uid://c0aoaemjratj1" path="res://Assets/Graphics/Terrains/forestsky.png" id="1_h6p24"]
[ext_resource type="Texture2D" uid="uid://cugs4plceapu2" path="res://Assets/Graphics/Terrains/forestbackground.png" id="2_vn7r1"] [ext_resource type="Texture2D" uid="uid://cugs4plceapu2" path="res://Assets/Graphics/Terrains/forestbackground.png" id="2_vn7r1"]
@ -11,6 +11,7 @@
[ext_resource type="PackedScene" uid="uid://cd7fv3pwgr880" path="res://Scenes/crate.tscn" id="9_p2sx0"] [ext_resource type="PackedScene" uid="uid://cd7fv3pwgr880" path="res://Scenes/crate.tscn" id="9_p2sx0"]
[ext_resource type="PackedScene" uid="uid://b5d8himq5sttt" path="res://Scenes/trigger.tscn" id="10_tc3ri"] [ext_resource type="PackedScene" uid="uid://b5d8himq5sttt" path="res://Scenes/trigger.tscn" id="10_tc3ri"]
[ext_resource type="PackedScene" uid="uid://dr1mp5x0cmbhw" path="res://Scenes/coin.tscn" id="11_3nkac"] [ext_resource type="PackedScene" uid="uid://dr1mp5x0cmbhw" path="res://Scenes/coin.tscn" id="11_3nkac"]
[ext_resource type="PackedScene" uid="uid://k42k25w6fsbo" path="res://Scenes/ui.tscn" id="12_vn7r1"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_v158k"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_v158k"]
texture = ExtResource("4_fpsp3") texture = ExtResource("4_fpsp3")
@ -486,5 +487,9 @@ position = Vector2(896, 372)
[node name="Enemies" type="Node2D" parent="."] [node name="Enemies" type="Node2D" parent="."]
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="UI" parent="CanvasLayer" instance=ExtResource("12_vn7r1")]
[connection signal="areatrigger" from="Triggers/Area2D2" to="." method="_on_areatrigger"] [connection signal="areatrigger" from="Triggers/Area2D2" to="." method="_on_areatrigger"]
[connection signal="areatrigger" from="Triggers/Area2D3" to="." method="_on_areatrigger"] [connection signal="areatrigger" from="Triggers/Area2D3" to="." method="_on_areatrigger"]

View File

@ -1,8 +1,24 @@
[gd_scene load_steps=9 format=3 uid="uid://cat3n1unb05u6"] [gd_scene load_steps=13 format=3 uid="uid://cat3n1unb05u6"]
[ext_resource type="Texture2D" uid="uid://1qmvigexa3to" path="res://Assets/Graphics/Enemies/slime_purple.png" id="1_jokqx"] [ext_resource type="Texture2D" uid="uid://1qmvigexa3to" path="res://Assets/Graphics/Enemies/slime_purple.png" id="1_jokqx"]
[ext_resource type="Script" uid="uid://vjdcp0a4i0j8" path="res://Scripts/slime.gd" id="1_swwnm"] [ext_resource type="Script" uid="uid://vjdcp0a4i0j8" path="res://Scripts/slime.gd" id="1_swwnm"]
[sub_resource type="AtlasTexture" id="AtlasTexture_5gljc"]
atlas = ExtResource("1_jokqx")
region = Rect2(0, 48, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_vblni"]
atlas = ExtResource("1_jokqx")
region = Rect2(24, 48, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_e388w"]
atlas = ExtResource("1_jokqx")
region = Rect2(48, 48, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_r4o34"]
atlas = ExtResource("1_jokqx")
region = Rect2(72, 48, 24, 24)
[sub_resource type="AtlasTexture" id="AtlasTexture_swwnm"] [sub_resource type="AtlasTexture" id="AtlasTexture_swwnm"]
atlas = ExtResource("1_jokqx") atlas = ExtResource("1_jokqx")
region = Rect2(0, 24, 24, 24) region = Rect2(0, 24, 24, 24)
@ -23,6 +39,23 @@ region = Rect2(72, 24, 24, 24)
animations = [{ animations = [{
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_5gljc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vblni")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_e388w")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_r4o34")
}],
"loop": false,
"name": &"hurt",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_swwnm") "texture": SubResource("AtlasTexture_swwnm")
}, { }, {
"duration": 1.0, "duration": 1.0,
@ -49,10 +82,10 @@ metadata/_edit_group_ = true
[node name="slimeGraphic" type="AnimatedSprite2D" parent="."] [node name="slimeGraphic" type="AnimatedSprite2D" parent="."]
texture_filter = 1 texture_filter = 1
sprite_frames = SubResource("SpriteFrames_5gljc") sprite_frames = SubResource("SpriteFrames_5gljc")
animation = &"idle" animation = &"hurt"
autoplay = "idle" autoplay = "idle"
frame = 1 frame = 3
frame_progress = 0.885206 frame_progress = 1.0
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 4) position = Vector2(0, 4)

47
Scenes/ui.tscn Normal file
View File

@ -0,0 +1,47 @@
[gd_scene load_steps=2 format=3 uid="uid://k42k25w6fsbo"]
[ext_resource type="Script" uid="uid://cw51scv08wj72" path="res://ui.gd" id="1_m1v6r"]
[node name="UI" 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_m1v6r")
[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="MarginContainer3" type="MarginContainer" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
[node name="Timer" type="Label" parent="VBoxContainer/HBoxContainer/MarginContainer3"]
layout_mode = 2
text = "Timer"
horizontal_alignment = 1
[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
text = "Coins"
horizontal_alignment = 2

View File

@ -1,6 +1,8 @@
class_name Bullet extends Area2D class_name Bullet extends Area2D
var speed = 700 var speed = 700
signal bulletDamageSignal(body, bullet)
# 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() -> void: func _ready() -> void:
pass # Replace with function body.func setSpeed(value): pass # Replace with function body.func setSpeed(value):
@ -11,3 +13,9 @@ func setSpeed(value):
# 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 _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
position += transform.x * speed * delta position += transform.x * speed * delta
func _on_area_entered(area: Area2D) -> void:
print("bullet is hitting area")
if area is Slime:
bulletDamageSignal.emit(area, self)

View File

@ -14,7 +14,7 @@ const JUMP_VELOCITY = -400.0
enum FaceDirection{LEFT, RIGHT} enum FaceDirection{LEFT, RIGHT}
var facing:FaceDirection = FaceDirection.RIGHT var facing:FaceDirection = FaceDirection.RIGHT
enum State{IDLE, RUN, JUMP, FALLING} enum State{IDLE, RUN, JUMP, FALLING, HURT, DEATH}
var current_state:State = State.IDLE var current_state:State = State.IDLE
var pushTarget var pushTarget
@ -22,6 +22,8 @@ var pushEnabled = false
var direction var direction
var upJump = false var upJump = false
signal deathAnimationCompleteSignal
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
#game loop #game loop
handle_input() handle_input()
@ -65,6 +67,10 @@ func update_animation():
player_graphic.play("jump") player_graphic.play("jump")
State.FALLING: State.FALLING:
player_graphic.play("falling") player_graphic.play("falling")
State.HURT:
player_graphic.play("hurt")
State.DEATH:
player_graphic.play("death")
func handle_movement(delta): func handle_movement(delta):
# Add the gravity. # Add the gravity.
if not is_on_floor(): if not is_on_floor():
@ -134,10 +140,16 @@ func _on_animation_finished() -> void:
match current_state: match current_state:
State.JUMP: State.JUMP:
upJump = false upJump = false
State.HURT:
current_state = State.IDLE
State.DEATH:
deathAnimationCompleteSignal.emit()
func playerTakesDamage(health): func playerTakesDamage(health):
print("Player sees remaining health "+str(health)) print("Player sees remaining health "+str(health))
current_state = State.HURT
func playerDies(): func playerDies():
print("Player sees they died.") print("Player sees they died.")
current_state = State.DEATH

View File

@ -13,5 +13,4 @@ func _process(delta: float) -> void:
func _on_body_entered(body: Node2D) -> void: func _on_body_entered(body: Node2D) -> void:
print("coin sees collision")
coinCollectedSignal.emit(body, self) coinCollectedSignal.emit(body, self)

1
Scripts/crate.gd Normal file
View File

@ -0,0 +1 @@
class_name Crate extends RigidBody2D

1
Scripts/crate.gd.uid Normal file
View File

@ -0,0 +1 @@
uid://b546t5rmhjwiu

View File

@ -3,24 +3,30 @@ extends Node2D
var totalCoinsAvailable var totalCoinsAvailable
var timer = Timer.new() var timer = Timer.new()
var timeAvailable = 5 var timeAvailable
var level="res://Scenes/game.tscn" var level="res://Scenes/game.tscn"
var levelTwo = "res://Scenes/level2.tscn" var levelTwo = "res://Scenes/level2.tscn"
var startingCoins = 0
var levels = ["res://Scenes/game.tscn", "res://Scenes/level2.tscn", "res://Scenes/level3.tscn"] var levels = ["res://Scenes/game.tscn", "res://Scenes/level2.tscn", "res://Scenes/level3.tscn"]
var timers = [10,15,9] var timers = [30,15,9]
var currentLevel = 0 var currentLevel = 0
signal destroySignal(body) signal destroySignal(body)
signal levelChangeSignal(level) signal levelChangeSignal(level)
signal playerTakesDamageSignal(health) signal playerTakesDamageSignal(health)
signal playerDiesSignal signal playerDiesSignal
signal bulletDamageEnemySignal(body)
signal countDownSignal(timeRemaining)
signal coinCountSignal(coinsRemaining, startingCoins)
var player:CharacterStats var player:CharacterStats
var enemy:CharacterStats var enemy:CharacterStats
var playerHealth:int var playerHealth:int
var enemiesDict = {}
# 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() -> void: func _ready() -> void:
player = load("res://Scripts/rscs/playerStats.tres") player = load("res://Scripts/rscs/playerStats.tres")
@ -36,12 +42,15 @@ func _ready() -> void:
func secondCounter() -> void: func secondCounter() -> void:
timeAvailable -=1 timeAvailable -=1
countDownSignal.emit(timeAvailable)
if timeAvailable <= 0: if timeAvailable <= 0:
print("LOSE") print("LOSE")
#reload the current scene #reload the current scene
levelChangeSignal.emit(levels[currentLevel]) levelChangeSignal.emit(levels[currentLevel])
func reset() -> void: func reset() -> void:
startingCoins = 0
timeAvailable = timers[currentLevel] timeAvailable = timers[currentLevel]
playerHealth = player.starting_health
# 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: float) -> void: func _process(delta: float) -> void:
@ -60,22 +69,45 @@ func _on_areatrigger(effect, body) -> void:
func totalCoinCount(totalCoins): func totalCoinCount(totalCoins):
print("GC knows the total coins is "+str(totalCoins) ) if startingCoins == 0:
startingCoins = totalCoins
totalCoinsAvailable = totalCoins totalCoinsAvailable = totalCoins
func coinCollected(body, coin): func coinCollected(body, coin):
destroySignal.emit(coin) if not body is Crate:
totalCoinsAvailable -=1 destroySignal.emit(coin)
if totalCoinsAvailable <= 0: totalCoinsAvailable -=1
currentLevel +=1 coinCountSignal.emit(totalCoinsAvailable, startingCoins)
if currentLevel >= levels.size(): if totalCoinsAvailable <= 0:
currentLevel = 0 currentLevel +=1
levelChangeSignal.emit(levels[currentLevel]) if currentLevel >= levels.size():
currentLevel = 0
levelChangeSignal.emit(levels[currentLevel])
func playerAttacked(body, slime): func playerAttacked(body, slime):
print("GC knows player attacked") print("GC knows player attacked")
playerHealth -= enemy.meleeDamage playerHealth -= enemiesDict[slime].damage
if playerHealth <=0: if playerHealth <=0:
playerDiesSignal.emit() playerDiesSignal.emit()
else: else:
print("Received damage...") print("Received damage...")
playerTakesDamageSignal.emit(playerHealth) playerTakesDamageSignal.emit(playerHealth)
func playerDead():
levelChangeSignal.emit(levels[currentLevel])
func bulletDamage(area, bullet):
enemiesDict[area].health -= player.rangeDamage
if enemiesDict[area].health <=0:
destroySignal.emit(area)
enemiesDict.erase(area)
else:
bulletDamageEnemySignal.emit(area)
func addEnemyToLevel(slime):
var randHealth:int = randi() % 20
var randDamage:int = randi() % 10
var enemyStat = {
"health":enemy.starting_health + randHealth,
"damage":enemy.meleeDamage + randDamage
}
enemiesDict[slime]=enemyStat

View File

@ -7,6 +7,7 @@ var totalAllowedBullets = 7
@onready var coins: Node2D = $"../Coins" @onready var coins: Node2D = $"../Coins"
@onready var enemies: Node2D = $"../Enemies" @onready var enemies: Node2D = $"../Enemies"
@onready var player: Player = $"../Player" @onready var player: Player = $"../Player"
@onready var ui: Control = $"../CanvasLayer/UI"
func _ready() -> void: func _ready() -> void:
@ -19,13 +20,20 @@ func _ready() -> void:
for obj in enemies.get_children(): for obj in enemies.get_children():
if obj is Slime: if obj is Slime:
obj.playerDamageSignal.connect(Gamecontroller.playerAttacked) obj.playerDamageSignal.connect(Gamecontroller.playerAttacked)
Gamecontroller.addEnemyToLevel(obj)
Gamecontroller.bulletDamageEnemySignal.connect(obj.takeDamage)
updateCoins() updateCoins()
Gamecontroller.destroySignal.connect(destroyItem) Gamecontroller.destroySignal.connect(destroyItem)
Gamecontroller.levelChangeSignal.connect(changeScene) Gamecontroller.levelChangeSignal.connect(changeScene)
Gamecontroller.playerTakesDamageSignal.connect(player.playerTakesDamage) Gamecontroller.playerTakesDamageSignal.connect(player.playerTakesDamage)
if ui:
Gamecontroller.playerTakesDamageSignal.connect(ui.healthUpdate)
Gamecontroller.countDownSignal.connect(ui.timerUpdate)
Gamecontroller.coinCountSignal.connect(ui.coinsUpdate)
Gamecontroller.playerDiesSignal.connect(player.playerDies) Gamecontroller.playerDiesSignal.connect(player.playerDies)
player.deathAnimationCompleteSignal.connect(Gamecontroller.playerDead)
#call this any time the coins change #call this any time the coins change
func updateCoins() -> void: func updateCoins() -> void:
@ -47,6 +55,7 @@ func bulletFactory():
if bulletArray.size() < totalAllowedBullets: if bulletArray.size() < totalAllowedBullets:
#make a new bullet #make a new bullet
mybullet = bullet.instantiate() mybullet = bullet.instantiate()
mybullet.bulletDamageSignal.connect(Gamecontroller.bulletDamage)
owner.add_child(mybullet) owner.add_child(mybullet)
else: else:
#recycle bullet #recycle bullet

View File

@ -26,12 +26,14 @@ func _process(delta: float) -> void:
slime_graphic.flip_h = false slime_graphic.flip_h = false
if right_side_cast.is_colliding(): if right_side_cast.is_colliding():
direction = -1 if not right_side_cast.get_collider() is Player && not right_side_cast.get_collider() is Slime:
slime_graphic.flip_h = true direction = -1
slime_graphic.flip_h = true
if left_side_cast.is_colliding(): if left_side_cast.is_colliding():
direction = 1 if not left_side_cast.get_collider() is Player && not left_side_cast.get_collider() is Slime:
slime_graphic.flip_h =false direction = 1
slime_graphic.flip_h =false
position.x += direction * speed * delta position.x += direction * speed * delta
@ -40,3 +42,7 @@ func _on_body_entered(body: Node2D) -> void:
if body is Player: if body is Player:
print("Slime attack") print("Slime attack")
playerDamageSignal.emit(body,self) playerDamageSignal.emit(body,self)
func takeDamage(body):
if body == self:
slime_graphic.play("hurt")

18
ui.gd Normal file
View File

@ -0,0 +1,18 @@
extends Control
@onready var health: Label = $VBoxContainer/HBoxContainer/MarginContainer/Health
@onready var timer: Label = $VBoxContainer/HBoxContainer/MarginContainer3/Timer
@onready var coins: Label = $VBoxContainer/HBoxContainer/MarginContainer2/Coins
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass
func healthUpdate(healthRemaining):
health.text = "Health: "+str(healthRemaining)
func timerUpdate(timeRemaining):
timer.text = str(timeRemaining)
func coinsUpdate(coinsRemaining, startingCoins):
coins.text = "Coins: "+str(coinsRemaining)+"/"+str(startingCoins)

1
ui.gd.uid Normal file
View File

@ -0,0 +1 @@
uid://cw51scv08wj72