Added demon enemy prototype

- Created Demon enemy scene with animations
- Implemented demon AI, detection, pursuit, attack, and damage systems
- Adjusted enemy collision layers to allow flying enemies to overlap the player
- Added and tested combat encounters in Demon Race and Graveyard memory levels
This commit is contained in:
doctorbatmanwho-creator 2026-06-15 19:00:32 -04:00
parent 0f7889adfb
commit f0d3931c37
24 changed files with 669 additions and 23 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://s1yejx4rd7w5"
path="res://.godot/imported/ATTACK.png-e7746883b0a06cd6b5cf2d6ab3ba04d1.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Graphics/Enemies/Demon/ATTACK.png"
dest_files=["res://.godot/imported/ATTACK.png-e7746883b0a06cd6b5cf2d6ab3ba04d1.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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: 6.5 KiB

View File

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ucdnvhxv3qmr"
path="res://.godot/imported/DEATH.png-a5e7372fb10b77248a8ae936b8402ff0.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Graphics/Enemies/Demon/DEATH.png"
dest_files=["res://.godot/imported/DEATH.png-a5e7372fb10b77248a8ae936b8402ff0.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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: 5.1 KiB

View File

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://0b1xky08ou2a"
path="res://.godot/imported/FLYING.png-a33efecc158ba21a737860511a27fe86.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Graphics/Enemies/Demon/FLYING.png"
dest_files=["res://.godot/imported/FLYING.png-a33efecc158ba21a737860511a27fe86.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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: 5.0 KiB

View File

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://7jepws8n5v7q"
path="res://.godot/imported/HURT.png-901bd34ba33c5ecb022ec48b52bb494d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Graphics/Enemies/Demon/HURT.png"
dest_files=["res://.godot/imported/HURT.png-901bd34ba33c5ecb022ec48b52bb494d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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: 5.3 KiB

View File

@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c5k5805pwyb5q"
path="res://.godot/imported/IDLE.png-f68893d54f335d6d18add8bc84a600d8.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Graphics/Enemies/Demon/IDLE.png"
dest_files=["res://.godot/imported/IDLE.png-f68893d54f335d6d18add8bc84a600d8.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

@ -0,0 +1,264 @@
[gd_scene load_steps=38 format=3 uid="uid://mpbyvdlj8q0v"]
[ext_resource type="Script" uid="uid://cukuvefvrcr3f" path="res://Scripts/demon.gd" id="1_02sxe"]
[ext_resource type="Texture2D" uid="uid://c5k5805pwyb5q" path="res://Assets/Graphics/Enemies/Demon/IDLE.png" id="1_nr56x"]
[ext_resource type="Texture2D" uid="uid://s1yejx4rd7w5" path="res://Assets/Graphics/Enemies/Demon/ATTACK.png" id="1_yqejl"]
[ext_resource type="Texture2D" uid="uid://ucdnvhxv3qmr" path="res://Assets/Graphics/Enemies/Demon/DEATH.png" id="2_02sxe"]
[ext_resource type="Texture2D" uid="uid://0b1xky08ou2a" path="res://Assets/Graphics/Enemies/Demon/FLYING.png" id="3_ohyyq"]
[ext_resource type="Texture2D" uid="uid://7jepws8n5v7q" path="res://Assets/Graphics/Enemies/Demon/HURT.png" id="4_w1cra"]
[sub_resource type="AtlasTexture" id="AtlasTexture_5rfnd"]
atlas = ExtResource("1_yqejl")
region = Rect2(0, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_ig148"]
atlas = ExtResource("1_yqejl")
region = Rect2(81, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_nbb7h"]
atlas = ExtResource("1_yqejl")
region = Rect2(162, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_20pyc"]
atlas = ExtResource("1_yqejl")
region = Rect2(243, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_p746w"]
atlas = ExtResource("1_yqejl")
region = Rect2(324, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_3xtmj"]
atlas = ExtResource("1_yqejl")
region = Rect2(405, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_alngn"]
atlas = ExtResource("1_yqejl")
region = Rect2(486, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_eayuf"]
atlas = ExtResource("1_yqejl")
region = Rect2(567, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_3vvkl"]
atlas = ExtResource("2_02sxe")
region = Rect2(0, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_oacwj"]
atlas = ExtResource("2_02sxe")
region = Rect2(81, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_fu5g0"]
atlas = ExtResource("2_02sxe")
region = Rect2(162, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_1lf72"]
atlas = ExtResource("2_02sxe")
region = Rect2(243, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_j4aro"]
atlas = ExtResource("2_02sxe")
region = Rect2(324, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_26ege"]
atlas = ExtResource("2_02sxe")
region = Rect2(405, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_b54qx"]
atlas = ExtResource("2_02sxe")
region = Rect2(486, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_8dk34"]
atlas = ExtResource("3_ohyyq")
region = Rect2(0, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_h1v6f"]
atlas = ExtResource("3_ohyyq")
region = Rect2(81, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_48ieo"]
atlas = ExtResource("3_ohyyq")
region = Rect2(162, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_1ulxg"]
atlas = ExtResource("3_ohyyq")
region = Rect2(243, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_k2uqu"]
atlas = ExtResource("4_w1cra")
region = Rect2(0, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_s0lji"]
atlas = ExtResource("4_w1cra")
region = Rect2(81, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_g8aks"]
atlas = ExtResource("4_w1cra")
region = Rect2(162, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_xtf25"]
atlas = ExtResource("4_w1cra")
region = Rect2(243, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_6eob1"]
atlas = ExtResource("1_nr56x")
region = Rect2(0, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_v5p4t"]
atlas = ExtResource("1_nr56x")
region = Rect2(81, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_f6610"]
atlas = ExtResource("1_nr56x")
region = Rect2(162, 0, 81, 71)
[sub_resource type="AtlasTexture" id="AtlasTexture_yqejl"]
atlas = ExtResource("1_nr56x")
region = Rect2(243, 0, 81, 71)
[sub_resource type="SpriteFrames" id="SpriteFrames_02sxe"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_5rfnd")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ig148")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_nbb7h")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_20pyc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_p746w")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_3xtmj")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_alngn")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_eayuf")
}],
"loop": false,
"name": &"attack",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_3vvkl")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_oacwj")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fu5g0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1lf72")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_j4aro")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_26ege")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_b54qx")
}],
"loop": false,
"name": &"death",
"speed": 10.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_8dk34")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_h1v6f")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_48ieo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1ulxg")
}],
"loop": true,
"name": &"flying",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_k2uqu")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_s0lji")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_g8aks")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_xtf25")
}],
"loop": false,
"name": &"hurt",
"speed": 12.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_6eob1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_v5p4t")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_f6610")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_yqejl")
}],
"loop": true,
"name": &"idle",
"speed": 12.0
}]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_ohyyq"]
radius = 41.0
height = 82.0
[sub_resource type="RectangleShape2D" id="RectangleShape2D_yqejl"]
size = Vector2(513, 63)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_02sxe"]
size = Vector2(60, 50)
[node name="Demon" type="CharacterBody2D"]
texture_filter = 1
collision_layer = 2
collision_mask = 0
script = ExtResource("1_02sxe")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_02sxe")
animation = &"flying"
frame_progress = 0.13023382
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-2, 2)
shape = SubResource("CapsuleShape2D_ohyyq")
debug_color = Color(0.49987894, 0.42888275, 1, 0.41960785)
[node name="DetectionArea" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="DetectionArea"]
position = Vector2(1.5, 0.5)
shape = SubResource("RectangleShape2D_yqejl")
debug_color = Color(0.3990774, 0.5954131, 0.3757497, 0.41960785)
[node name="AttackHitbox" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="AttackHitbox"]
shape = SubResource("RectangleShape2D_02sxe")
debug_color = Color(0.9642144, 0.14822191, 0.31210807, 0.41960785)

View File

@ -382,9 +382,9 @@ position = Vector2(-5, 12)
shape = SubResource("CapsuleShape2D_yek4v")
debug_color = Color(0.61885023, 0.36088452, 0.99050516, 0.41960785)
[node name="Area2D" type="Area2D" parent="."]
[node name="DetectionArea" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="DetectionArea"]
position = Vector2(12.5, 13.5)
shape = SubResource("RectangleShape2D_yek4v")
debug_color = Color(0.51556015, 0.56157154, 0.37343058, 0.41960785)

View File

@ -12,7 +12,7 @@
[ext_resource type="Texture2D" uid="uid://qrp76dhq6c5j" path="res://Assets/Graphics/Terrains/Items/window.png" id="8_85qyi"]
[ext_resource type="Texture2D" uid="uid://cvxul7b7lxxmq" path="res://Assets/Graphics/Terrains/Items/studytable.png" id="9_iivbl"]
[ext_resource type="PackedScene" uid="uid://b5d8himq5sttt" path="res://Scenes/trigger.tscn" id="9_t1ymx"]
[ext_resource type="PackedScene" uid="uid://dr1mp5x0cmbhw" path="res://Scenes/coin.tscn" id="10_0cp8e"]
[ext_resource type="PackedScene" uid="uid://dr1mp5x0cmbhw" path="res://Scenes/Items/coin.tscn" id="10_0cp8e"]
[ext_resource type="PackedScene" uid="uid://k42k25w6fsbo" path="res://Scenes/ui.tscn" id="13_rfjv2"]
[ext_resource type="Script" uid="uid://cbp0lclhmd1db" path="res://Scripts/stair.gd" id="14_7nbq1"]
[ext_resource type="Texture2D" uid="uid://qt1rsjh2pyye" path="res://Assets/Graphics/Terrains/Items/circdesk.png" id="17_7nbq1"]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=32 format=4 uid="uid://bcray1583u4e6"]
[gd_scene load_steps=33 format=4 uid="uid://bcray1583u4e6"]
[ext_resource type="Texture2D" uid="uid://deprjxf7mfx2j" path="res://Assets/Graphics/Terrains/Background/Demon Woods/parallax-demon-woods-bg.png" id="1_aiupx"]
[ext_resource type="Texture2D" uid="uid://rqo2a3nuk173" path="res://Assets/Graphics/Terrains/Background/Demon Woods/parallax-demon-woods-far-trees.png" id="2_v8qg6"]
@ -6,7 +6,7 @@
[ext_resource type="Texture2D" uid="uid://c6svcdw8rw64o" path="res://Assets/Graphics/Terrains/Background/Demon Woods/parallax-demon-woods-close-trees.png" id="4_ai43x"]
[ext_resource type="Texture2D" uid="uid://dg3nhen8cfl3n" path="res://Assets/Graphics/Terrains/Tileset/smaller night terrain red.png" id="5_v8qg6"]
[ext_resource type="PackedScene" uid="uid://b5d8himq5sttt" path="res://Scenes/trigger.tscn" id="9_osu04"]
[ext_resource type="PackedScene" uid="uid://dr1mp5x0cmbhw" path="res://Scenes/coin.tscn" id="10_y4887"]
[ext_resource type="PackedScene" uid="uid://dr1mp5x0cmbhw" path="res://Scenes/Items/coin.tscn" id="10_y4887"]
[ext_resource type="PackedScene" uid="uid://k42k25w6fsbo" path="res://Scenes/ui.tscn" id="11_otmkx"]
[ext_resource type="Texture2D" uid="uid://dx7kxlon71y1p" path="res://Assets/Graphics/Terrains/Items/Kids/LibraryWindow.png" id="14_ai43x"]
[ext_resource type="Texture2D" uid="uid://bgdq31arm2m6u" path="res://Assets/Graphics/Terrains/Items/Kids/book1.png" id="16_6fou7"]
@ -23,6 +23,7 @@
[ext_resource type="Texture2D" uid="uid://df55khvmq7ud2" path="res://Assets/Graphics/Terrains/Items/Kids/bedroom.png" id="24_mrgau"]
[ext_resource type="Texture2D" uid="uid://dawtfoxvia0ln" path="res://Assets/Graphics/Terrains/Items/Kids/doll.png" id="25_fo64u"]
[ext_resource type="Texture2D" uid="uid://c3gnq3kpcgr7w" path="res://Assets/Graphics/Terrains/Items/Kids/blankets.png" id="25_mrgau"]
[ext_resource type="PackedScene" uid="uid://mpbyvdlj8q0v" path="res://Scenes/Characters/Demon.tscn" id="26_bhn1t"]
[ext_resource type="Texture2D" uid="uid://ccivnuoxj4osh" path="res://Assets/Graphics/Terrains/Items/Kids/stuffies.png" id="26_y10ne"]
[ext_resource type="Texture2D" uid="uid://cldc5pnvwspu6" path="res://Assets/Graphics/Terrains/Items/Kids/train.png" id="27_b138e"]
@ -482,7 +483,7 @@ texture = ExtResource("19_osu04")
[node name="Runn" type="Sprite2D" parent="Decor"]
texture_filter = 1
position = Vector2(157, 146)
position = Vector2(300, 146)
scale = Vector2(0.5, 0.5)
texture = ExtResource("20_y4887")
@ -525,12 +526,14 @@ scale = Vector2(0.3, 0.3)
texture = ExtResource("25_mrgau")
[node name="Table" type="Sprite2D" parent="Decor"]
z_index = 20
texture_filter = 1
position = Vector2(3400, 200)
scale = Vector2(0.1, 0.1)
texture = ExtResource("23_mrgau")
[node name="Lamp" type="Sprite2D" parent="Decor"]
z_index = 20
texture_filter = 1
position = Vector2(3419, 146)
scale = Vector2(0.2, 0.2)
@ -558,21 +561,21 @@ texture = ExtResource("27_b138e")
[node name="Book1" type="Sprite2D" parent="Decor"]
texture_filter = 1
position = Vector2(603, 153)
position = Vector2(697, 153.00002)
scale = Vector2(0.2, 0.2)
texture = ExtResource("16_6fou7")
[node name="Book2" type="Sprite2D" parent="Decor"]
z_index = 10
texture_filter = 1
position = Vector2(578, 157)
position = Vector2(671.99994, 157)
scale = Vector2(0.3, 0.3)
texture = ExtResource("17_6aau3")
[node name="Book3" type="Sprite2D" parent="Decor"]
z_index = 20
texture_filter = 1
position = Vector2(548, 167)
position = Vector2(642, 167.00002)
scale = Vector2(0.35, 0.35)
texture = ExtResource("18_osu04")
@ -588,5 +591,8 @@ texture = ExtResource("14_ai43x")
[node name="UI" parent="CanvasLayer" instance=ExtResource("11_otmkx")]
metadata/_edit_use_anchors_ = true
[node name="Demon" parent="." instance=ExtResource("26_bhn1t")]
position = Vector2(869, 199)
[connection signal="areatrigger" from="Triggers/Area2D2" to="." method="_on_areatrigger"]
[connection signal="areatrigger" from="Triggers/Area2D3" to="." method="_on_areatrigger"]

View File

@ -7,10 +7,10 @@
[ext_resource type="Texture2D" uid="uid://c4mr5woa76b3y" path="res://Assets/Graphics/Terrains/Background/Graveyard/parallax-rod-hangers.png" id="6_3f4w8"]
[ext_resource type="Texture2D" uid="uid://dg3nhen8cfl3n" path="res://Assets/Graphics/Terrains/Tileset/smaller night terrain red.png" id="6_tpoa3"]
[ext_resource type="Texture2D" uid="uid://b1wqerdo7h6s7" path="res://Assets/Graphics/Terrains/Tileset/night.png" id="7_tpoa3"]
[ext_resource type="PackedScene" uid="uid://dr1mp5x0cmbhw" path="res://Scenes/coin.tscn" id="8_3jtcq"]
[ext_resource type="PackedScene" uid="uid://dr1mp5x0cmbhw" path="res://Scenes/Items/coin.tscn" id="8_3jtcq"]
[ext_resource type="Texture2D" uid="uid://cs8d635bhjsd4" path="res://Assets/Graphics/Terrains/Tileset/smaller night terrain blue.png" id="8_qo1gf"]
[ext_resource type="PackedScene" uid="uid://k42k25w6fsbo" path="res://Scenes/ui.tscn" id="9_dvm4i"]
[ext_resource type="PackedScene" uid="uid://bnvrarj8b5adq" path="res://Scenes/MemoryPiece.tscn" id="10_3jtcq"]
[ext_resource type="PackedScene" uid="uid://bnvrarj8b5adq" path="res://Scenes/Items/MemoryPiece.tscn" id="10_3jtcq"]
[ext_resource type="Texture2D" uid="uid://defq1skb78lvn" path="res://Assets/Graphics/Terrains/Items/Graveyard/backpack.png" id="11_ye1nu"]
[ext_resource type="Texture2D" uid="uid://d34w3kh75t7dq" path="res://Assets/Graphics/Pickups/Memory/MemoryPiece2.png" id="12_kty81"]
[ext_resource type="Texture2D" uid="uid://bqeigjeet88t8" path="res://Assets/Graphics/Terrains/Items/Graveyard/laundry.png" id="12_lwbjw"]
@ -20,13 +20,13 @@
[ext_resource type="Texture2D" uid="uid://bxldigevoox35" path="res://Assets/Graphics/Pickups/Memory/MemoryPiece5.png" id="15_8awmo"]
[ext_resource type="Texture2D" uid="uid://cvvmc62m0uy3e" path="res://Assets/Graphics/Pickups/Memory/MemoryPiece1.png" id="16_3jtcq"]
[ext_resource type="Texture2D" uid="uid://b1abq20dk3w86" path="res://Assets/Graphics/Terrains/Items/Graveyard/small dresser.png" id="16_dvm4i"]
[ext_resource type="PackedScene" uid="uid://dyxbksdpg14iw" path="res://Scenes/Wardrobe.tscn" id="17_dvm4i"]
[ext_resource type="PackedScene" uid="uid://dyxbksdpg14iw" path="res://Scenes/Items/Wardrobe.tscn" id="17_dvm4i"]
[ext_resource type="Texture2D" uid="uid://bkfxc66elss34" path="res://Assets/Graphics/Terrains/Background/Memories/Memory3.png" id="22_8awmo"]
[ext_resource type="Texture2D" uid="uid://b2vsf70jov55u" path="res://Assets/Graphics/Terrains/Background/Memories/Memory1.png" id="23_8awmo"]
[ext_resource type="Texture2D" uid="uid://b0g2yq4wolooy" path="res://Assets/Graphics/Terrains/Background/Memories/Memory2.png" id="23_8qp07"]
[ext_resource type="Texture2D" uid="uid://d3u7nur0ua1vb" path="res://Assets/Graphics/Terrains/Background/Memories/Memory5.png" id="25_6kan1"]
[ext_resource type="Texture2D" uid="uid://cwlxblkouwtxr" path="res://Assets/Graphics/Terrains/Background/Memories/Memory4.png" id="25_8elfy"]
[ext_resource type="PackedScene" uid="uid://0lyd0y14s0w4" path="res://Scenes/Skeleton.tscn" id="26_pyeu7"]
[ext_resource type="PackedScene" uid="uid://0lyd0y14s0w4" path="res://Scenes/Characters/Skeleton.tscn" id="26_pyeu7"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_3jtcq"]
texture = ExtResource("7_tpoa3")
@ -873,6 +873,59 @@ position = Vector2(1109, 386)
[node name="Enemies" type="Node2D" parent="."]
position = Vector2(122, 11)
[node name="Skeleton" parent="Enemies" node_paths=PackedStringArray("memory_return_spawn", "memory_wardrobe") instance=ExtResource("26_pyeu7")]
position = Vector2(274, 1100)
memory_piece_scene = ExtResource("10_3jtcq")
memory_texture = ExtResource("16_3jtcq")
memory_return_spawn = NodePath("../../ReturnSpawns/ReturnSpawn1")
memory_wardrobe = NodePath("../../Wardrobes/Wardrobe1")
[node name="Skeleton2" parent="Enemies" node_paths=PackedStringArray("memory_return_spawn", "memory_wardrobe") instance=ExtResource("26_pyeu7")]
position = Vector2(3039, 1087)
memory_piece_scene = ExtResource("10_3jtcq")
memory_texture = ExtResource("12_kty81")
memory_return_spawn = NodePath("../../ReturnSpawns/ReturnSpawn2")
memory_wardrobe = NodePath("../../Wardrobes/Wardrobe2")
[node name="Skeleton3" parent="Enemies" instance=ExtResource("26_pyeu7")]
position = Vector2(3173, 1088)
[node name="Skeleton4" parent="Enemies" instance=ExtResource("26_pyeu7")]
position = Vector2(3323, 1089)
[node name="Skeleton5" parent="Enemies" instance=ExtResource("26_pyeu7")]
position = Vector2(-28, 2393)
[node name="Skeleton6" parent="Enemies" node_paths=PackedStringArray("memory_return_spawn", "memory_wardrobe") instance=ExtResource("26_pyeu7")]
position = Vector2(85, 2394)
memory_piece_scene = ExtResource("10_3jtcq")
memory_texture = ExtResource("13_o5ghh")
memory_return_spawn = NodePath("../../ReturnSpawns/ReturnSpawn3")
memory_wardrobe = NodePath("../../Wardrobes/Wardrobe3")
[node name="Skeleton7" parent="Enemies" instance=ExtResource("26_pyeu7")]
position = Vector2(195, 2402)
[node name="Skeleton8" parent="Enemies" instance=ExtResource("26_pyeu7")]
position = Vector2(322, 2396)
[node name="Skeleton9" parent="Enemies" instance=ExtResource("26_pyeu7")]
position = Vector2(3460, 2396)
[node name="Skeleton10" parent="Enemies" node_paths=PackedStringArray("memory_return_spawn", "memory_wardrobe") instance=ExtResource("26_pyeu7")]
position = Vector2(3701, 2400)
memory_piece_scene = ExtResource("10_3jtcq")
memory_texture = ExtResource("15_8awmo")
memory_return_spawn = NodePath("../../ReturnSpawns/ReturnSpawn5")
memory_wardrobe = NodePath("../../Wardrobes/Wardrobe5")
[node name="Skeleton11" parent="Enemies" node_paths=PackedStringArray("memory_return_spawn", "memory_wardrobe") instance=ExtResource("26_pyeu7")]
position = Vector2(1522, 1760)
memory_piece_scene = ExtResource("10_3jtcq")
memory_texture = ExtResource("14_8qp07")
memory_return_spawn = NodePath("../../ReturnSpawns/ReturnSpawn4")
memory_wardrobe = NodePath("../../Wardrobes/Wardrobe4")
[node name="Decor" type="Node2D" parent="."]
[node name="CombatBackgrounds" type="Node2D" parent="Decor"]
@ -927,13 +980,6 @@ position = Vector2(2194, 239.00002)
scale = Vector2(0.15, 0.15)
texture = ExtResource("16_dvm4i")
[node name="Skeleton" parent="Decor" node_paths=PackedStringArray("memory_return_spawn", "memory_wardrobe") instance=ExtResource("26_pyeu7")]
position = Vector2(396, 1111)
memory_piece_scene = ExtResource("10_3jtcq")
memory_texture = ExtResource("16_3jtcq")
memory_return_spawn = NodePath("../../ReturnSpawns/ReturnSpawn1")
memory_wardrobe = NodePath("../../Wardrobes/Wardrobe1")
[node name="Boundaries" type="Node2D" parent="."]
position = Vector2(574, 596)

View File

@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://coknidvakx3e5"]
[ext_resource type="PackedScene" uid="uid://bu8e4iyw8pc03" path="res://Scenes/Player.tscn" id="1_d5ayw"]
[ext_resource type="PackedScene" uid="uid://bu8e4iyw8pc03" path="res://Scenes/Characters/Player.tscn" id="1_d5ayw"]
[ext_resource type="Script" uid="uid://bs4frobn6kxne" path="res://Scripts/scene_manager.gd" id="2_us1pb"]
[ext_resource type="PackedScene" uid="uid://8n6472fqqmcc" path="res://Scenes/Levels/Level_3_graveyard.tscn" id="3_d5ayw"]
[ext_resource type="PackedScene" uid="uid://bcray1583u4e6" path="res://Scenes/Levels/Level_2_demons.tscn" id="3_d5ayw"]
[node name="MainGame" type="Node2D"]
@ -13,4 +13,4 @@ script = ExtResource("2_us1pb")
[node name="CurrentLevel" type="Node2D" parent="."]
[node name="Graveyard" parent="CurrentLevel" instance=ExtResource("3_d5ayw")]
[node name="DemonRace" parent="CurrentLevel" instance=ExtResource("3_d5ayw")]

129
Scripts/demon.gd Normal file
View File

@ -0,0 +1,129 @@
extends CharacterBody2D
@export var speed := 90.0
@export var max_health := 3
@export var attack_range := 35.0
@export var stop_distance := 25.0
@onready var sprite: AnimatedSprite2D = $AnimatedSprite2D
@onready var detection_area: Area2D = $DetectionArea
@onready var attack_hitbox: Area2D = $AttackHitbox
var health := 3
var player: Player = null
var is_dead := false
var is_hurt := false
var is_attacking := false
var attack_cooldown := false
func _ready() -> void:
health = max_health
attack_hitbox.monitoring = false
sprite.play("idle")
detection_area.body_entered.connect(_on_detection_body_entered)
detection_area.body_exited.connect(_on_detection_body_exited)
sprite.animation_finished.connect(_on_animation_finished)
func _physics_process(_delta: float) -> void:
if is_dead:
return
if is_hurt or is_attacking:
velocity = Vector2.ZERO
move_and_slide()
return
if player:
var x_distance := player.global_position.x - global_position.x
if abs(x_distance) > attack_range:
velocity.x = sign(x_distance) * speed
velocity.y = 0
sprite.play("flying")
if x_distance < 0:
sprite.flip_h = false
else:
sprite.flip_h = true
else:
velocity = Vector2.ZERO
attack()
else:
velocity = Vector2.ZERO
sprite.play("idle")
move_and_slide()
func attack() -> void:
if is_attacking or attack_cooldown:
return
is_attacking = true
attack_cooldown = true
velocity = Vector2.ZERO
sprite.play("attack")
await get_tree().create_timer(0.2).timeout
do_attack_damage()
func do_attack_damage() -> void:
print("Demon checking attack hit")
attack_hitbox.monitoring = true
await get_tree().physics_frame
await get_tree().physics_frame
var bodies = attack_hitbox.get_overlapping_bodies()
print("Demon bodies found: ", bodies.size())
for body in bodies:
if body is Player:
print("DEMON HIT PLAYER")
body.playerTakesDamage(1)
attack_hitbox.monitoring = false
func take_damage(amount: int = 1) -> void:
if is_dead:
return
health -= amount
print("Demon health:", health)
if health <= 0:
die()
else:
is_hurt = true
velocity = Vector2.ZERO
sprite.play("hurt")
func die() -> void:
if is_dead:
return
is_dead = true
velocity = Vector2.ZERO
sprite.play("death")
print("Demon died")
func _on_detection_body_entered(body: Node) -> void:
if body is Player:
player = body
print("Demon detected player")
func _on_detection_body_exited(body: Node) -> void:
if body == player:
player = null
print("Demon lost player")
func _on_animation_finished() -> void:
if sprite.animation == "hurt":
is_hurt = false
if sprite.animation == "attack":
is_attacking = false
await get_tree().create_timer(1.0).timeout
attack_cooldown = false
if sprite.animation == "death":
queue_free()

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

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