fight system and whatnot

This commit is contained in:
2025-10-29 01:47:45 +01:00
parent 527be3ee5d
commit 84f75cb2a7
41 changed files with 1433 additions and 57 deletions

BIN
aseprite/attack.aseprite Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
aseprite/skull.aseprite Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c1yunf5rn1ncd"
path="res://.godot/imported/attack.png-2cfcc8cfa42d648f76fae46c4823b97e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/spritesheets/attack.png"
dest_files=["res://.godot/imported/attack.png-2cfcc8cfa42d648f76fae46c4823b97e.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://dsapnb753puib"
path="res://.godot/imported/dark_house_assets.png-5b4f16c3b2bac7ea51c517c5ed69aad2.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/spritesheets/dark_house_assets.png"
dest_files=["res://.godot/imported/dark_house_assets.png-5b4f16c3b2bac7ea51c517c5ed69aad2.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: 32 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cj28uue3ibju4"
path="res://.godot/imported/explosion.png-a255340e5a22a052cb2de3e325a49006.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/spritesheets/explosion.png"
dest_files=["res://.godot/imported/explosion.png-a255340e5a22a052cb2de3e325a49006.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: 380 B

View File

@@ -3,15 +3,15 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://5pbgeg3yx6cd" uid="uid://5pbgeg3yx6cd"
path="res://.godot/imported/heart.png-0efefdd245172a860e354a0c110700fc.ctex" path="res://.godot/imported/heart.png-b859c8314af5d01e464245f568d254ab.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://assets/textures/heart.png" source_file="res://assets/textures/spritesheets/heart.png"
dest_files=["res://.godot/imported/heart.png-0efefdd245172a860e354a0c110700fc.ctex"] dest_files=["res://.godot/imported/heart.png-b859c8314af5d01e464245f568d254ab.ctex"]
[params] [params]

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c886j66l82ncy"
path="res://.godot/imported/skull.png-98b27d26afd4c757dfebc837a7efd43f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/spritesheets/skull.png"
dest_files=["res://.godot/imported/skull.png-98b27d26afd4c757dfebc837a7efd43f.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: 883 B

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://2aopgpvv473r"
path="res://.godot/imported/level_interior_tileset.png-75528c6b73d7db3296f599b394b4bd4f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/tilemaps/level_interior_tileset.png"
dest_files=["res://.godot/imported/level_interior_tileset.png-75528c6b73d7db3296f599b394b4bd4f.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

@@ -43,6 +43,10 @@ window/size/mode.release=4
enabled=PackedStringArray("res://addons/TileMapDual/plugin.cfg", "res://addons/dialogue_manager/plugin.cfg") enabled=PackedStringArray("res://addons/TileMapDual/plugin.cfg", "res://addons/dialogue_manager/plugin.cfg")
[global_group]
Enemy="All enemies with pathfinding"
[gui] [gui]
theme/default_font_antialiasing=0 theme/default_font_antialiasing=0

View File

@@ -0,0 +1,130 @@
[gd_resource type="SpriteFrames" load_steps=19 format=3 uid="uid://bl36fbm1g0x3"]
[ext_resource type="Texture2D" uid="uid://cj28uue3ibju4" path="res://assets/textures/spritesheets/explosion.png" id="1_gjs8n"]
[sub_resource type="AtlasTexture" id="AtlasTexture_16r5y"]
atlas = ExtResource("1_gjs8n")
region = Rect2(0, 0, 202, 202)
[sub_resource type="AtlasTexture" id="AtlasTexture_x7j8h"]
atlas = ExtResource("1_gjs8n")
region = Rect2(202, 0, 202, 202)
[sub_resource type="AtlasTexture" id="AtlasTexture_j2yjp"]
atlas = ExtResource("1_gjs8n")
region = Rect2(404, 0, 202, 202)
[sub_resource type="AtlasTexture" id="AtlasTexture_fn6pb"]
atlas = ExtResource("1_gjs8n")
region = Rect2(606, 0, 202, 202)
[sub_resource type="AtlasTexture" id="AtlasTexture_gnwjt"]
atlas = ExtResource("1_gjs8n")
region = Rect2(808, 0, 202, 202)
[sub_resource type="AtlasTexture" id="AtlasTexture_lhham"]
atlas = ExtResource("1_gjs8n")
region = Rect2(0, 202, 202, 202)
[sub_resource type="AtlasTexture" id="AtlasTexture_utqf1"]
atlas = ExtResource("1_gjs8n")
region = Rect2(202, 202, 202, 202)
[sub_resource type="AtlasTexture" id="AtlasTexture_2rpcc"]
atlas = ExtResource("1_gjs8n")
region = Rect2(404, 202, 202, 202)
[sub_resource type="AtlasTexture" id="AtlasTexture_gtt86"]
atlas = ExtResource("1_gjs8n")
region = Rect2(606, 202, 202, 202)
[sub_resource type="AtlasTexture" id="AtlasTexture_w6lqy"]
atlas = ExtResource("1_gjs8n")
region = Rect2(808, 202, 202, 202)
[sub_resource type="AtlasTexture" id="AtlasTexture_aarit"]
atlas = ExtResource("1_gjs8n")
region = Rect2(0, 404, 202, 202)
[sub_resource type="AtlasTexture" id="AtlasTexture_kug7w"]
atlas = ExtResource("1_gjs8n")
region = Rect2(202, 404, 202, 202)
[sub_resource type="AtlasTexture" id="AtlasTexture_vbd1p"]
atlas = ExtResource("1_gjs8n")
region = Rect2(404, 404, 202, 202)
[sub_resource type="AtlasTexture" id="AtlasTexture_l16b2"]
atlas = ExtResource("1_gjs8n")
region = Rect2(606, 404, 202, 202)
[sub_resource type="AtlasTexture" id="AtlasTexture_k2ltt"]
atlas = ExtResource("1_gjs8n")
region = Rect2(808, 404, 202, 202)
[sub_resource type="AtlasTexture" id="AtlasTexture_yd17a"]
atlas = ExtResource("1_gjs8n")
region = Rect2(0, 606, 202, 202)
[sub_resource type="AtlasTexture" id="AtlasTexture_et1j0"]
atlas = ExtResource("1_gjs8n")
region = Rect2(202, 606, 202, 202)
[resource]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_16r5y")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_x7j8h")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_j2yjp")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fn6pb")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gnwjt")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_lhham")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_utqf1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2rpcc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gtt86")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_w6lqy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_aarit")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kug7w")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vbd1p")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_l16b2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_k2ltt")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_yd17a")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_et1j0")
}],
"loop": true,
"name": &"default",
"speed": 10.0
}]

111
scenes/enemies/skull.tscn Normal file
View File

@@ -0,0 +1,111 @@
[gd_scene load_steps=12 format=3 uid="uid://sr8t2lu6apr4"]
[ext_resource type="Texture2D" uid="uid://c886j66l82ncy" path="res://assets/textures/spritesheets/skull.png" id="1_04wrl"]
[ext_resource type="Script" uid="uid://cuc28u7op02gq" path="res://scripts/enemies/skull.gd" id="1_xx1px"]
[ext_resource type="PackedScene" uid="uid://de71apm4hg6i" path="res://scenes/fightable.tscn" id="3_3gsvf"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_04wrl"]
radius = 9.0
[sub_resource type="CircleShape2D" id="CircleShape2D_04wrl"]
radius = 250.79872
[sub_resource type="CircleShape2D" id="CircleShape2D_xx1px"]
radius = 35.014282
[sub_resource type="AtlasTexture" id="AtlasTexture_3gsvf"]
atlas = ExtResource("1_04wrl")
region = Rect2(0, 0, 32, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_17hur"]
atlas = ExtResource("1_04wrl")
region = Rect2(32, 0, 32, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_lgdni"]
atlas = ExtResource("1_04wrl")
region = Rect2(64, 0, 32, 64)
[sub_resource type="AtlasTexture" id="AtlasTexture_7f2rg"]
atlas = ExtResource("1_04wrl")
region = Rect2(96, 0, 32, 64)
[sub_resource type="SpriteFrames" id="SpriteFrames_bidx4"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_3gsvf")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_17hur")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_lgdni")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7f2rg")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_lgdni")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_3gsvf")
}],
"loop": true,
"name": &"default",
"speed": 10.0
}]
[node name="Skull" type="CharacterBody2D"]
y_sort_enabled = true
collision_layer = 0
collision_mask = 2
script = ExtResource("1_xx1px")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(1, 11)
rotation = 1.5707964
shape = SubResource("CapsuleShape2D_04wrl")
[node name="NavigationAgent2D" type="NavigationAgent2D" parent="."]
target_desired_distance = 20.0
avoidance_enabled = true
radius = 16.0
neighbor_distance = 48.0
[node name="VisibleOnScreenEnabler2D" type="VisibleOnScreenEnabler2D" parent="."]
[node name="Area2D" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" groups=["Enemy"]]
shape = SubResource("CircleShape2D_04wrl")
debug_color = Color(0.4897036, 0.51211786, 0.7549306, 0.41960785)
[node name="FollowUpdateTimer" type="Timer" parent="."]
[node name="AttackTimer" type="Timer" parent="."]
[node name="AttackArea" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="AttackArea"]
position = Vector2(1, -8)
shape = SubResource("CircleShape2D_xx1px")
debug_color = Color(0.7831714, 0.38409948, 0.54320604, 0.41960785)
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(0, -15)
sprite_frames = SubResource("SpriteFrames_bidx4")
[node name="Fightable" parent="." instance=ExtResource("3_3gsvf")]
[connection signal="velocity_computed" from="NavigationAgent2D" to="." method="_on_navigation_agent_2d_velocity_computed"]
[connection signal="body_entered" from="Area2D" to="." method="_on_area_body_entered"]
[connection signal="body_exited" from="Area2D" to="." method="_on_area_body_exited"]
[connection signal="timeout" from="FollowUpdateTimer" to="." method="_on_follow_update_timer_timeout"]
[connection signal="timeout" from="AttackTimer" to="." method="_on_attack_timer_timeout"]
[connection signal="body_entered" from="AttackArea" to="." method="_on_attack_area_body_entered"]
[connection signal="body_exited" from="AttackArea" to="." method="_on_attack_area_body_exited"]
[connection signal="fought" from="Fightable" to="." method="_on_fightable_fought"]

13
scenes/fightable.tscn Normal file
View File

@@ -0,0 +1,13 @@
[gd_scene load_steps=3 format=3 uid="uid://de71apm4hg6i"]
[ext_resource type="Script" uid="uid://cvd86i6imfk24" path="res://scripts/fightable.gd" id="1_k4gqj"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ij5l6"]
size = Vector2(32, 32)
[node name="Fightable" type="Area2D"]
collision_layer = 2
script = ExtResource("1_k4gqj")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_ij5l6")

View File

@@ -0,0 +1,28 @@
[gd_scene load_steps=5 format=3 uid="uid://56kyfhgeh23"]
[ext_resource type="Texture2D" uid="uid://db4dctk13rgbm" path="res://assets/textures/spritesheets/houses.png" id="1_bgi5t"]
[ext_resource type="PackedScene" uid="uid://h77hilgbces" path="res://scenes/interactables/interact_sceneswitch.tscn" id="2_8jyyi"]
[sub_resource type="AtlasTexture" id="AtlasTexture_fltv6"]
atlas = ExtResource("1_bgi5t")
region = Rect2(1, 2, 158, 151)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0afuu"]
size = Vector2(143.51248, 50.587547)
[node name="Home" type="StaticBody2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(-2, -28)
texture = SubResource("AtlasTexture_fltv6")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
y_sort_enabled = true
position = Vector2(-2.2344398, 23.292198)
rotation = -0.0021335608
shape = SubResource("RectangleShape2D_0afuu")
debug_color = Color(0.8768643, 0.34231007, 0.046793222, 0.41960785)
[node name="InteractSceneswitch" parent="." instance=ExtResource("2_8jyyi")]
position = Vector2(49, 32)
scene = "res://scenes/levels/lvl_1.tscn"

View File

@@ -0,0 +1,27 @@
[gd_scene load_steps=5 format=3 uid="uid://bf1tj6ldl520h"]
[ext_resource type="Texture2D" uid="uid://db4dctk13rgbm" path="res://assets/textures/spritesheets/houses.png" id="1_wi6m7"]
[ext_resource type="PackedScene" uid="uid://h77hilgbces" path="res://scenes/interactables/interact_sceneswitch.tscn" id="2_ey5b0"]
[sub_resource type="AtlasTexture" id="AtlasTexture_fltv6"]
atlas = ExtResource("1_wi6m7")
region = Rect2(482, 11, 158, 133)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0afuu"]
size = Vector2(152.00409, 48.003414)
[node name="Home" type="StaticBody2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(-2, -28)
texture = SubResource("AtlasTexture_fltv6")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
y_sort_enabled = true
position = Vector2(-2.0000806, 15.002504)
rotation = -0.0021335608
shape = SubResource("RectangleShape2D_0afuu")
debug_color = Color(0.8768643, 0.34231007, 0.046793222, 0.41960785)
[node name="InteractSceneswitch" parent="." instance=ExtResource("2_ey5b0")]
position = Vector2(52, 23)

View File

@@ -0,0 +1,37 @@
[gd_scene load_steps=6 format=3 uid="uid://cj4j8j3fbpkek"]
[ext_resource type="Texture2D" uid="uid://db4dctk13rgbm" path="res://assets/textures/spritesheets/houses.png" id="1_ucxgm"]
[ext_resource type="PackedScene" uid="uid://h77hilgbces" path="res://scenes/interactables/interact_sceneswitch.tscn" id="2_k43hx"]
[sub_resource type="AtlasTexture" id="AtlasTexture_fltv6"]
atlas = ExtResource("1_ucxgm")
region = Rect2(2, 169, 158, 147)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0afuu"]
size = Vector2(146.99966, 50.839867)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ucxgm"]
size = Vector2(78.98275, 7.0426574)
[node name="Home" type="StaticBody2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(-2, -28)
texture = SubResource("AtlasTexture_fltv6")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
y_sort_enabled = true
position = Vector2(-2.554564, 13.423307)
rotation = -0.0021335608
shape = SubResource("RectangleShape2D_0afuu")
debug_color = Color(0.8768643, 0.34231007, 0.046793222, 0.41960785)
[node name="CollisionShape2D2" type="CollisionShape2D" parent="."]
y_sort_enabled = true
position = Vector2(-36.507423, 42.520287)
rotation = -0.0021335608
shape = SubResource("RectangleShape2D_ucxgm")
debug_color = Color(0.8768643, 0.34231007, 0.046793222, 0.41960785)
[node name="InteractSceneswitch" parent="." instance=ExtResource("2_k43hx")]
position = Vector2(-36, 30)

View File

@@ -0,0 +1,37 @@
[gd_scene load_steps=6 format=3 uid="uid://cevq6x1qnwwwo"]
[ext_resource type="Texture2D" uid="uid://db4dctk13rgbm" path="res://assets/textures/spritesheets/houses.png" id="1_cm1ot"]
[ext_resource type="PackedScene" uid="uid://h77hilgbces" path="res://scenes/interactables/interact_sceneswitch.tscn" id="2_1wvia"]
[sub_resource type="AtlasTexture" id="AtlasTexture_fltv6"]
atlas = ExtResource("1_cm1ot")
region = Rect2(322, 16, 157, 128)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0afuu"]
size = Vector2(149.02954, 46.397488)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ucxgm"]
size = Vector2(64.457184, 19.574635)
[node name="Home" type="StaticBody2D"]
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(-2, -28)
texture = SubResource("AtlasTexture_fltv6")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
y_sort_enabled = true
position = Vector2(1.5026193, -6.772405)
rotation = -0.0021335608
shape = SubResource("RectangleShape2D_0afuu")
debug_color = Color(0.8768643, 0.34231007, 0.046793222, 0.41960785)
[node name="CollisionShape2D2" type="CollisionShape2D" parent="."]
y_sort_enabled = true
position = Vector2(-40.2494, 26.281471)
rotation = -0.0021335608
shape = SubResource("RectangleShape2D_ucxgm")
debug_color = Color(0.8768643, 0.34231007, 0.046793222, 0.41960785)
[node name="InteractSceneswitch" parent="." instance=ExtResource("2_1wvia")]
position = Vector2(-55, 20)

View File

@@ -9,7 +9,7 @@ load_path = "res://.godot/imported/table_chair.png-e74f8b9bc13823f10c8b29c28e9a3
[sub_resource type="AtlasTexture" id="AtlasTexture_asrj3"] [sub_resource type="AtlasTexture" id="AtlasTexture_asrj3"]
resource_local_to_scene = true resource_local_to_scene = true
atlas = SubResource("CompressedTexture2D_o804i") atlas = SubResource("CompressedTexture2D_o804i")
region = Rect2(-3, 0, 32, 32) region = Rect2(0, 0, 32, 32)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_w04lg"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_w04lg"]
size = Vector2(14, 18) size = Vector2(14, 18)

View File

@@ -0,0 +1,129 @@
[gd_scene load_steps=9 format=3 uid="uid://cac5cla8jdogn"]
[ext_resource type="Texture2D" uid="uid://dsapnb753puib" path="res://assets/textures/spritesheets/dark_house_assets.png" id="1_s5xo4"]
[ext_resource type="PackedScene" uid="uid://n24dhbpflcec" path="res://scenes/interactable.tscn" id="2_ljyl3"]
[sub_resource type="GDScript" id="GDScript_enrye"]
script/source = "extends StaticBody2D
@onready var animation_player: AnimationPlayer = $AnimationPlayer
@onready var anti_softlock_marker: Marker2D = $AntiSoftlockMarker
var open: bool = false
var open1: bool = true
func _on_interactable_interacted(_player: Player) -> void:
if !open:
animation_player.play(\"open\")
open = true
func _on_interactable_body_exited(body: Node2D) -> void:
if open1 && body is Player:
animation_player.speed_scale = 4
animation_player.play_backwards(\"open\")
open1 = false
await animation_player.animation_finished
body.global_position = anti_softlock_marker.global_position
"
[sub_resource type="AtlasTexture" id="AtlasTexture_nmjqc"]
atlas = ExtResource("1_s5xo4")
region = Rect2(160, 64, 32, 64)
[sub_resource type="Animation" id="Animation_ra1dx"]
resource_name = "open"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:texture:region")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Rect2(160, 64, 32, 64), Rect2(144, 64, 32, 64)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("CollisionShape2D2:shape:size")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(48, 5), Vector2(16, 5)]
}
[sub_resource type="Animation" id="Animation_xbx8n"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:texture:region")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Rect2(160, 64, 32, 64)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("CollisionShape2D2:shape:size")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(48, 5)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_clxe4"]
_data = {
&"RESET": SubResource("Animation_xbx8n"),
&"open": SubResource("Animation_ra1dx")
}
[sub_resource type="RectangleShape2D" id="RectangleShape2D_xpwqa"]
size = Vector2(48, 5)
[node name="DarkHouseDoor" type="StaticBody2D"]
script = SubResource("GDScript_enrye")
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(32, -16)
texture = SubResource("AtlasTexture_nmjqc")
[node name="Sprite2D2" type="Sprite2D" parent="."]
position = Vector2(0, -16)
texture = SubResource("AtlasTexture_nmjqc")
flip_h = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
&"": SubResource("AnimationLibrary_clxe4")
}
[node name="Interactable" parent="." instance=ExtResource("2_ljyl3")]
position = Vector2(16, 20)
auto_interact = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-8, 13.5)
shape = SubResource("RectangleShape2D_xpwqa")
[node name="CollisionShape2D2" type="CollisionShape2D" parent="."]
position = Vector2(40, 14)
shape = SubResource("RectangleShape2D_xpwqa")
[node name="AntiSoftlockMarker" type="Marker2D" parent="."]
position = Vector2(16, -26)
[connection signal="body_exited" from="Interactable" to="." method="_on_interactable_body_exited"]
[connection signal="interacted" from="Interactable" to="." method="_on_interactable_interacted"]

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=4 uid="uid://ccfdsdgaon63m"] [gd_scene load_steps=11 format=4 uid="uid://ccfdsdgaon63m"]
[ext_resource type="Texture2D" uid="uid://ctr2whxnff2vn" path="res://assets/textures/tilemaps/main_house_interior_tileset.png" id="1_2vl8h"] [ext_resource type="Texture2D" uid="uid://ctr2whxnff2vn" path="res://assets/textures/tilemaps/main_house_interior_tileset.png" id="1_2vl8h"]
[ext_resource type="PackedScene" uid="uid://dfbomt0l6b1o4" path="res://scenes/player.tscn" id="1_ikf4c"] [ext_resource type="PackedScene" uid="uid://dfbomt0l6b1o4" path="res://scenes/player.tscn" id="1_ikf4c"]
@@ -17,20 +17,6 @@ func _ready() -> void:
RenderingServer.set_default_clear_color(\"#0d0805\") RenderingServer.set_default_clear_color(\"#0d0805\")
" "
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_yskkl"]
texture = ExtResource("1_snitx")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
1:0/0 = 0
0:1/0 = 0
0:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-12, -4, 16, -4, 16, 16, -12, 16)
1:1/0 = 0
1:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -4, 12, -4, 12, 16, -16, 16)
0:2/0 = 0
0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-11.5, -16, 16, -16, 16, -7, -2, -7, -2, 7, -8, 7)
1:2/0 = 0
1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 12, -16, 12, -7.5, 9, 7, 2, 7, 2, -7, -16, -7)
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_5uvba"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_5uvba"]
texture = ExtResource("1_2vl8h") texture = ExtResource("1_2vl8h")
texture_region_size = Vector2i(32, 32) texture_region_size = Vector2i(32, 32)
@@ -96,7 +82,6 @@ terrain_set_0/mode = 0
terrain_set_0/terrain_0/name = "Ground 0" terrain_set_0/terrain_0/name = "Ground 0"
terrain_set_0/terrain_0/color = Color(0.5, 0.34375, 0.25, 1) terrain_set_0/terrain_0/color = Color(0.5, 0.34375, 0.25, 1)
sources/1 = SubResource("TileSetAtlasSource_5uvba") sources/1 = SubResource("TileSetAtlasSource_5uvba")
sources/0 = SubResource("TileSetAtlasSource_yskkl")
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_d1b6h"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_d1b6h"]
texture = ExtResource("1_snitx") texture = ExtResource("1_snitx")
@@ -108,9 +93,9 @@ texture_region_size = Vector2i(32, 32)
1:1/0 = 0 1:1/0 = 0
1:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, 5.5, 12, 5.5, 12, 16, -16, 16) 1:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, 5.5, 12, 5.5, 12, 16, -16, 16)
0:2/0 = 0 0:2/0 = 0
0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-11.5, -16, 16, -16, 16, -7, -2, -7, -2, 7, -8, 7) 0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-12, -16, 16, -16, 16, 11, -11.5, 11.5)
1:2/0 = 0 1:2/0 = 0
1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 12, -16, 12, -7.5, 9, 7, 2, 7, 2, -7, -16, -7) 1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 12, -16, 12, 11, -16, 11)
[sub_resource type="TileSet" id="TileSet_cchwu"] [sub_resource type="TileSet" id="TileSet_cchwu"]
tile_size = Vector2i(32, 32) tile_size = Vector2i(32, 32)
@@ -157,6 +142,9 @@ y_sort_enabled = true
position = Vector2(176, 235) position = Vector2(176, 235)
tilemap = NodePath("../TileMapLayer") tilemap = NodePath("../TileMapLayer")
[node name="AnimatedSprite2D" parent="Player" index="0"]
animation = &"up"
[node name="InteractSceneswitch" parent="." instance=ExtResource("4_snitx")] [node name="InteractSceneswitch" parent="." instance=ExtResource("4_snitx")]
position = Vector2(176, 268) position = Vector2(176, 268)
scene = "res://scenes/levels/hood.tscn" scene = "res://scenes/levels/hood.tscn"

File diff suppressed because one or more lines are too long

155
scenes/levels/lvl_1.tscn Normal file
View File

@@ -0,0 +1,155 @@
[gd_scene load_steps=15 format=4 uid="uid://bdpobbbi6apq5"]
[ext_resource type="Texture2D" uid="uid://2aopgpvv473r" path="res://assets/textures/tilemaps/level_interior_tileset.png" id="1_satx0"]
[ext_resource type="PackedScene" uid="uid://dfbomt0l6b1o4" path="res://scenes/player.tscn" id="2_0t8x2"]
[ext_resource type="PackedScene" uid="uid://sr8t2lu6apr4" path="res://scenes/enemies/skull.tscn" id="3_u5kpk"]
[sub_resource type="NavigationPolygon" id="NavigationPolygon_0t8x2"]
vertices = PackedVector2Array(16, 16, 2, 16, 2, 10, 16, 10)
polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)])
outlines = Array[PackedVector2Array]([PackedVector2Array(2, 10, 16, 10, 16, 16, 2, 16)])
agent_radius = 0.0
[sub_resource type="NavigationPolygon" id="NavigationPolygon_u5kpk"]
vertices = PackedVector2Array(16, 16, 2, 16, 2, -16, 16, -16)
polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)])
outlines = Array[PackedVector2Array]([PackedVector2Array(2, -16, 16, -16, 16, 16, 2, 16)])
agent_radius = 0.0
[sub_resource type="NavigationPolygon" id="NavigationPolygon_ij6uy"]
vertices = PackedVector2Array(16, -8, 2, -8, 2, -16, 16, -16)
polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)])
outlines = Array[PackedVector2Array]([PackedVector2Array(2, -16, 16, -16, 16, -8, 2, -8)])
agent_radius = 0.0
[sub_resource type="NavigationPolygon" id="NavigationPolygon_piajy"]
vertices = PackedVector2Array(16, 16, -16, 16, -16, 10, 16, 10)
polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)])
outlines = Array[PackedVector2Array]([PackedVector2Array(-16, 10, 16, 10, 16, 16, -16, 16)])
agent_radius = 0.0
[sub_resource type="NavigationPolygon" id="NavigationPolygon_v45sh"]
vertices = PackedVector2Array(16, 16, -16, 16, -16, -16, 16, -16)
polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)])
outlines = Array[PackedVector2Array]([PackedVector2Array(-16, -16, 16, -16, 16, 16, -16, 16)])
agent_radius = 0.0
[sub_resource type="NavigationPolygon" id="NavigationPolygon_l6efi"]
vertices = PackedVector2Array(16, -8, -16, -8, -16, -16, 16, -16)
polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)])
outlines = Array[PackedVector2Array]([PackedVector2Array(-16, -16, 16, -16, 16, -8, -16, -8)])
agent_radius = 0.0
[sub_resource type="NavigationPolygon" id="NavigationPolygon_3u0n1"]
vertices = PackedVector2Array(-1, 16, -16, 16, -16, 10, -1, 10)
polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)])
outlines = Array[PackedVector2Array]([PackedVector2Array(-16, 10, -1, 10, -1, 16, -16, 16)])
agent_radius = 0.0
[sub_resource type="NavigationPolygon" id="NavigationPolygon_2lf8p"]
vertices = PackedVector2Array(-1.5, 16, -16, 16, -16, -16, -1.5, -16)
polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)])
outlines = Array[PackedVector2Array]([PackedVector2Array(-16, -16, -1.5, -16, -1.5, 16, -16, 16)])
agent_radius = 0.0
[sub_resource type="NavigationPolygon" id="NavigationPolygon_vpggf"]
vertices = PackedVector2Array(-1, -8, -16, -8, -16, -16, -1, -16)
polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3)])
outlines = Array[PackedVector2Array]([PackedVector2Array(-16, -16, -1, -16, -1, -8, -16, -8)])
agent_radius = 0.0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_u5kpk"]
texture = ExtResource("1_satx0")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
0:0/0/terrain_set = 0
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 10, 2, 10, 2, 16, -16, 16)
0:0/0/terrains_peering_bit/bottom_right_corner = 0
0:0/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_0t8x2")
1:0/0 = 0
1:0/0/terrain_set = 0
1:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 10, -16, 10)
1:0/0/terrains_peering_bit/bottom_right_corner = 0
1:0/0/terrains_peering_bit/bottom_side = 0
1:0/0/terrains_peering_bit/bottom_left_corner = 0
1:0/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_piajy")
2:0/0 = 0
2:0/0/terrain_set = 0
2:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 16, -16, 16, 16, -1, 16, -0.9796982, 10, -16, 10)
2:0/0/terrains_peering_bit/bottom_left_corner = 0
2:0/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_3u0n1")
0:1/0 = 0
0:1/0/terrain_set = 0
0:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 2, -16, 2, 16, -16, 16)
0:1/0/terrains_peering_bit/right_side = 0
0:1/0/terrains_peering_bit/bottom_right_corner = 0
0:1/0/terrains_peering_bit/top_right_corner = 0
0:1/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_u5kpk")
1:1/0 = 0
1:1/0/terrain_set = 0
1:1/0/terrain = 0
1:1/0/terrains_peering_bit/right_side = 0
1:1/0/terrains_peering_bit/bottom_right_corner = 0
1:1/0/terrains_peering_bit/bottom_side = 0
1:1/0/terrains_peering_bit/bottom_left_corner = 0
1:1/0/terrains_peering_bit/left_side = 0
1:1/0/terrains_peering_bit/top_left_corner = 0
1:1/0/terrains_peering_bit/top_side = 0
1:1/0/terrains_peering_bit/top_right_corner = 0
1:1/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_v45sh")
2:1/0 = 0
2:1/0/terrain_set = 0
2:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-1, -16, 16, -16, 16, 16, -1, 16)
2:1/0/terrains_peering_bit/bottom_left_corner = 0
2:1/0/terrains_peering_bit/left_side = 0
2:1/0/terrains_peering_bit/top_left_corner = 0
2:1/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_2lf8p")
0:2/0 = 0
0:2/0/terrain_set = 0
0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-16, -16, 2, -16, 2, -8, 16, -8, 16, 16, -16, 16)
0:2/0/terrains_peering_bit/top_right_corner = 0
0:2/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_ij6uy")
1:2/0 = 0
1:2/0/terrain_set = 0
1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(16, 16, -16, 16, -16, -8, 16, -8)
1:2/0/terrains_peering_bit/top_left_corner = 0
1:2/0/terrains_peering_bit/top_side = 0
1:2/0/terrains_peering_bit/top_right_corner = 0
1:2/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_l6efi")
2:2/0 = 0
2:2/0/terrain_set = 0
2:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-1, -16, 16, -16, 16, 16, -16, 16, -16, -8, -1, -8)
2:2/0/terrains_peering_bit/top_left_corner = 0
2:2/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_vpggf")
[sub_resource type="TileSet" id="TileSet_u5kpk"]
tile_size = Vector2i(32, 32)
physics_layer_0/collision_layer = 1
terrain_set_0/mode = 0
terrain_set_0/terrain_0/name = "Ground 0"
terrain_set_0/terrain_0/color = Color(0.5, 0.34375, 0.25, 1)
navigation_layer_0/layers = 1
sources/1 = SubResource("TileSetAtlasSource_u5kpk")
[node name="Lvl1" type="Node2D"]
y_sort_enabled = true
[node name="TileMapLayer" type="TileMapLayer" parent="."]
z_index = -1
y_sort_enabled = true
tile_map_data = PackedByteArray("AAD//wAAAQABAAEAAAAAAAAAAQABAAEAAAAAAAEAAQABAAEAAAD//wEAAQABAAEAAAD+/wEAAQABAAEAAAD+/wAAAQABAAEAAAD+////AQABAAEAAAD/////AQABAAEAAAAAAP//AQABAAEAAAABAAAAAQABAAEAAAABAAEAAQABAAEAAAABAP//AQABAAEAAAAAAP7/AQABAAEAAAABAP7/AQABAAEAAAD///7/AQABAAEAAAD+//7/AQABAAEAAAACAP//AQABAAEAAAACAAAAAQABAAEAAAACAP7/AQABAAEAAAADAP//AQABAAEAAAADAAAAAQABAAEAAAADAP7/AQABAAEAAAAEAP//AQABAAEAAAAEAAAAAQABAAEAAAAEAP7/AQABAAEAAAAEAP3/AQABAAEAAAAFAP3/AQACAAEAAAAFAP7/AQACAAEAAAADAP3/AQABAAEAAAADAPz/AQABAAEAAAAEAPz/AQABAAEAAAAFAPz/AQACAAEAAAAFAP//AQACAAEAAAACAP3/AQABAAEAAAACAPz/AQABAAEAAAABAP3/AQABAAEAAAABAPz/AQABAAEAAAAAAP3/AQABAAEAAAAAAPz/AQABAAEAAAD///3/AQABAAEAAAD///z/AQABAAEAAAD+//3/AQABAAEAAAD+//z/AQABAAEAAAD9////AQABAAEAAAD9//7/AQABAAEAAAD9//3/AQABAAEAAAD9//z/AQABAAEAAAD9/wAAAQABAAEAAAD9/wEAAQABAAEAAAACAAEAAQABAAEAAAACAAIAAQABAAEAAAABAAIAAQABAAEAAAAAAAIAAQABAAEAAAD//wIAAQABAAEAAAD+/wIAAQABAAEAAAD9/wIAAQABAAEAAAADAAEAAQABAAEAAAADAAIAAQABAAEAAAAEAAEAAQABAAEAAAAEAAIAAQABAAEAAAAFAAAAAQACAAEAAAAFAAEAAQACAAEAAAAFAAIAAQACAAEAAAD8/wIAAQABAAEAAAD8/wMAAQABAAIAAAD7/wMAAQABAAIAAAD7/wIAAQABAAEAAAD7/wEAAQABAAEAAAD8/wEAAQABAAEAAAD7/wAAAQABAAEAAAD8/wAAAQABAAEAAAD7////AQABAAEAAAD8////AQABAAEAAAD7//7/AQABAAEAAAD8//7/AQABAAEAAAD7//3/AQABAAEAAAD8//3/AQABAAEAAAD7//z/AQABAAEAAAD8//z/AQABAAEAAAD9/wMAAQABAAIAAAD+/wMAAQABAAIAAAD//wMAAQABAAIAAAAAAAMAAQABAAIAAAABAAMAAQABAAIAAAACAAMAAQABAAIAAAADAAMAAQABAAIAAAAEAAMAAQABAAIAAAAFAAMAAQACAAIAAAD6/wMAAQAAAAIAAAD6/wIAAQAAAAEAAAD6/wEAAQAAAAEAAAD6/wAAAQAAAAEAAAD6////AQAAAAEAAAD6//7/AQAAAAEAAAD6//3/AQAAAAEAAAD6//z/AQAAAAEAAAD6//v/AQAAAAAAAAD7//v/AQABAAAAAAD8//v/AQABAAAAAAD9//v/AQABAAAAAAD+//v/AQABAAAAAAD///v/AQABAAAAAAAAAPv/AQABAAAAAAABAPv/AQABAAAAAAACAPv/AQABAAAAAAADAPv/AQABAAAAAAAEAPv/AQABAAAAAAAFAPv/AQACAAAAAAA=")
tile_set = SubResource("TileSet_u5kpk")
rendering_quadrant_size = 32
physics_quadrant_size = 32
[node name="Player" parent="." node_paths=PackedStringArray("tilemap") instance=ExtResource("2_0t8x2")]
tilemap = NodePath("../TileMapLayer")
[node name="Skull" parent="." instance=ExtResource("3_u5kpk")]
position = Vector2(-111, -50)
[node name="Skull2" parent="." instance=ExtResource("3_u5kpk")]
position = Vector2(8, -106)
[node name="Skull3" parent="." instance=ExtResource("3_u5kpk")]
position = Vector2(140, -102)

16
scenes/menus/hud.tscn Normal file
View File

@@ -0,0 +1,16 @@
[gd_scene load_steps=3 format=3 uid="uid://c48stuhi2qml3"]
[ext_resource type="PackedScene" uid="uid://b7bd4lqwlheti" path="res://scenes/menus/util/hearts.tscn" id="1_xmy64"]
[sub_resource type="GDScript" id="GDScript_xmy64"]
script/source = "class_name HUD
extends CanvasLayer
@onready var hearts: Hearts = $Hearts
"
[node name="HUD" type="CanvasLayer"]
script = SubResource("GDScript_xmy64")
[node name="Hearts" parent="." instance=ExtResource("1_xmy64")]
health = 7

View File

@@ -0,0 +1,95 @@
[gd_scene load_steps=10 format=3 uid="uid://b7bd4lqwlheti"]
[ext_resource type="Texture2D" uid="uid://5pbgeg3yx6cd" path="res://assets/textures/spritesheets/heart.png" id="1_fn71o"]
[ext_resource type="Script" uid="uid://cfplt163iotph" path="res://scripts/menus/util/hearts.gd" id="1_nty8h"]
[sub_resource type="AtlasTexture" id="AtlasTexture_xmy64"]
atlas = ExtResource("1_fn71o")
region = Rect2(33, 1, 14, 13)
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_tfgnj"]
load_path = "res://.godot/imported/heart.png-0efefdd245172a860e354a0c110700fc.ctex"
[sub_resource type="AtlasTexture" id="AtlasTexture_nty8h"]
atlas = SubResource("CompressedTexture2D_tfgnj")
region = Rect2(1, 1, 14, 13)
[sub_resource type="AtlasTexture" id="AtlasTexture_6ej26"]
atlas = SubResource("CompressedTexture2D_tfgnj")
region = Rect2(1, 1, 14, 13)
[sub_resource type="AtlasTexture" id="AtlasTexture_gx0d8"]
atlas = SubResource("CompressedTexture2D_tfgnj")
region = Rect2(1, 1, 14, 13)
[sub_resource type="AtlasTexture" id="AtlasTexture_prrtw"]
atlas = SubResource("CompressedTexture2D_tfgnj")
region = Rect2(1, 1, 14, 13)
[sub_resource type="AtlasTexture" id="AtlasTexture_yvsuk"]
atlas = SubResource("CompressedTexture2D_tfgnj")
region = Rect2(1, 1, 14, 13)
[node name="Hearts" type="Control"]
layout_mode = 3
anchors_preset = 0
offset_left = 8.0
offset_top = 8.0
offset_right = 8.0
offset_bottom = 8.0
script = ExtResource("1_nty8h")
[node name="BackgroundContainer" type="HBoxContainer" parent="."]
layout_mode = 0
offset_right = 86.0
offset_bottom = 13.0
[node name="TextureRect" type="TextureRect" parent="BackgroundContainer"]
layout_mode = 2
texture = SubResource("AtlasTexture_xmy64")
stretch_mode = 2
[node name="TextureRect2" type="TextureRect" parent="BackgroundContainer"]
layout_mode = 2
texture = SubResource("AtlasTexture_xmy64")
stretch_mode = 2
[node name="TextureRect3" type="TextureRect" parent="BackgroundContainer"]
layout_mode = 2
texture = SubResource("AtlasTexture_xmy64")
stretch_mode = 2
[node name="TextureRect4" type="TextureRect" parent="BackgroundContainer"]
layout_mode = 2
texture = SubResource("AtlasTexture_xmy64")
stretch_mode = 2
[node name="TextureRect5" type="TextureRect" parent="BackgroundContainer"]
layout_mode = 2
texture = SubResource("AtlasTexture_xmy64")
stretch_mode = 2
[node name="HeartContainer" type="HBoxContainer" parent="."]
layout_mode = 0
offset_right = 14.0
offset_bottom = 13.0
[node name="TextureRect" type="TextureRect" parent="HeartContainer"]
layout_mode = 2
texture = SubResource("AtlasTexture_nty8h")
[node name="TextureRect2" type="TextureRect" parent="HeartContainer"]
layout_mode = 2
texture = SubResource("AtlasTexture_6ej26")
[node name="TextureRect3" type="TextureRect" parent="HeartContainer"]
layout_mode = 2
texture = SubResource("AtlasTexture_gx0d8")
[node name="TextureRect4" type="TextureRect" parent="HeartContainer"]
layout_mode = 2
texture = SubResource("AtlasTexture_prrtw")
[node name="TextureRect5" type="TextureRect" parent="HeartContainer"]
layout_mode = 2
texture = SubResource("AtlasTexture_yvsuk")

View File

@@ -1,7 +1,9 @@
[gd_scene load_steps=22 format=3 uid="uid://dfbomt0l6b1o4"] [gd_scene load_steps=31 format=3 uid="uid://dfbomt0l6b1o4"]
[ext_resource type="Script" uid="uid://dxvslwwnnlosy" path="res://scripts/player.gd" id="1_3vyb7"] [ext_resource type="Script" uid="uid://dxvslwwnnlosy" path="res://scripts/player.gd" id="1_3vyb7"]
[ext_resource type="Texture2D" uid="uid://d06cv484ev2n3" path="res://assets/textures/spritesheets/normal_player.png" id="2_qhqgy"] [ext_resource type="Texture2D" uid="uid://d06cv484ev2n3" path="res://assets/textures/spritesheets/normal_player.png" id="2_qhqgy"]
[ext_resource type="PackedScene" uid="uid://c48stuhi2qml3" path="res://scenes/menus/hud.tscn" id="3_qhqgy"]
[ext_resource type="Texture2D" uid="uid://c1yunf5rn1ncd" path="res://assets/textures/spritesheets/attack.png" id="4_dqkch"]
[sub_resource type="AtlasTexture" id="AtlasTexture_dqkch"] [sub_resource type="AtlasTexture" id="AtlasTexture_dqkch"]
atlas = ExtResource("2_qhqgy") atlas = ExtResource("2_qhqgy")
@@ -15,30 +17,30 @@ region = Rect2(32, 0, 32, 32)
atlas = ExtResource("2_qhqgy") atlas = ExtResource("2_qhqgy")
region = Rect2(64, 0, 32, 32) region = Rect2(64, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_fjrip"]
atlas = ExtResource("2_qhqgy")
region = Rect2(0, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_3v2ag"] [sub_resource type="AtlasTexture" id="AtlasTexture_3v2ag"]
atlas = ExtResource("2_qhqgy") atlas = ExtResource("2_qhqgy")
region = Rect2(96, 64, 32, 32) region = Rect2(96, 64, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_jej6c"] [sub_resource type="AtlasTexture" id="AtlasTexture_fjrip"]
atlas = ExtResource("2_qhqgy") atlas = ExtResource("2_qhqgy")
region = Rect2(96, 0, 32, 32) region = Rect2(0, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_f1ej7"] [sub_resource type="AtlasTexture" id="AtlasTexture_f1ej7"]
atlas = ExtResource("2_qhqgy") atlas = ExtResource("2_qhqgy")
region = Rect2(0, 96, 32, 32) region = Rect2(0, 96, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_oprun"] [sub_resource type="AtlasTexture" id="AtlasTexture_jej6c"]
atlas = ExtResource("2_qhqgy") atlas = ExtResource("2_qhqgy")
region = Rect2(64, 32, 32, 32) region = Rect2(96, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_a8ls1"] [sub_resource type="AtlasTexture" id="AtlasTexture_a8ls1"]
atlas = ExtResource("2_qhqgy") atlas = ExtResource("2_qhqgy")
region = Rect2(32, 96, 32, 32) region = Rect2(32, 96, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_oprun"]
atlas = ExtResource("2_qhqgy")
region = Rect2(64, 32, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_qfm1y"] [sub_resource type="AtlasTexture" id="AtlasTexture_qfm1y"]
atlas = ExtResource("2_qhqgy") atlas = ExtResource("2_qhqgy")
region = Rect2(96, 0, 32, 32) region = Rect2(96, 0, 32, 32)
@@ -92,36 +94,36 @@ animations = [{
}, { }, {
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_fjrip") "texture": SubResource("AtlasTexture_3v2ag")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_3v2ag") "texture": SubResource("AtlasTexture_fjrip")
}], }],
"loop": true, "loop": false,
"name": &"hand_down", "name": &"hand_down",
"speed": 3.0 "speed": 4.0
}, { }, {
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_jej6c")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_f1ej7") "texture": SubResource("AtlasTexture_f1ej7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_jej6c")
}], }],
"loop": true, "loop": false,
"name": &"hand_side", "name": &"hand_side",
"speed": 3.0 "speed": 4.0
}, { }, {
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_oprun") "texture": SubResource("AtlasTexture_a8ls1")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_a8ls1") "texture": SubResource("AtlasTexture_oprun")
}], }],
"loop": true, "loop": false,
"name": &"hand_up", "name": &"hand_up",
"speed": 3.0 "speed": 4.0
}, { }, {
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
@@ -178,7 +180,58 @@ animations = [{
radius = 6.0 radius = 6.0
height = 14.0 height = 14.0
[sub_resource type="AtlasTexture" id="AtlasTexture_d2wvv"]
atlas = ExtResource("4_dqkch")
region = Rect2(0, 0, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_i4ail"]
atlas = ExtResource("4_dqkch")
region = Rect2(0, 16, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_a38lo"]
atlas = ExtResource("4_dqkch")
region = Rect2(0, 32, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_4ni07"]
atlas = ExtResource("4_dqkch")
region = Rect2(0, 48, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_l71n6"]
atlas = ExtResource("4_dqkch")
region = Rect2(0, 64, 32, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_y4r1p"]
atlas = ExtResource("4_dqkch")
region = Rect2(0, 80, 32, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_ke2ow"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_d2wvv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_i4ail")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_a38lo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4ni07")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_l71n6")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_y4r1p")
}],
"loop": false,
"name": &"default",
"speed": 12.0
}]
[node name="Player" type="CharacterBody2D"] [node name="Player" type="CharacterBody2D"]
collision_layer = 3
motion_mode = 1 motion_mode = 1
script = ExtResource("1_3vyb7") script = ExtResource("1_3vyb7")
@@ -198,8 +251,20 @@ drag_horizontal_enabled = true
drag_vertical_enabled = true drag_vertical_enabled = true
[node name="RayCast2D" type="RayCast2D" parent="."] [node name="RayCast2D" type="RayCast2D" parent="."]
target_position = Vector2(0, 32) position = Vector2(0, 10)
target_position = Vector2(0, 22)
collision_mask = 2 collision_mask = 2
hit_from_inside = true hit_from_inside = true
collide_with_areas = true collide_with_areas = true
collide_with_bodies = false collide_with_bodies = false
[node name="HUD" parent="." instance=ExtResource("3_qhqgy")]
[node name="CursorHideTimer" type="Timer" parent="."]
[node name="FightAnimation" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_ke2ow")
frame = 5
frame_progress = 1.0
offset = Vector2(0, 24)
flip_v = true

86
scripts/enemies/skull.gd Normal file
View File

@@ -0,0 +1,86 @@
extends CharacterBody2D
@export var speed: int = 900
@onready var navigation_agent_2d: NavigationAgent2D = $NavigationAgent2D
@onready var follow_update_timer: Timer = $FollowUpdateTimer
@onready var attack_timer: Timer = $AttackTimer
@onready var animated_sprite: AnimatedSprite2D = $AnimatedSprite2D
var idle: bool = true
const DAMAGE: int = 1
var health: int = 8
var target: Player = null
var in_attack_range: bool = false
var stop_distance: int = 20
var attack_cooldown_offset: float = 0.0
var flicker_time: float = 0.2
var flicker_timer: float = 0.0
func _ready() -> void:
navigation_agent_2d.avoidance_priority = randf_range(0.5, 1.0)
attack_cooldown_offset = randf_range(0.0, 0.5)
animated_sprite.speed_scale = randf_range(0.4, 1.2)
func _process(delta: float) -> void:
if flicker_timer > 0.0:
flicker_timer -= delta
animated_sprite.modulate = Color(1, 0, 0)
if flicker_timer <= 0.0:
animated_sprite.modulate = Color(1, 1, 1)
func _on_area_body_entered(body: Node2D) -> void:
if body is Player:
idle = false
target = body
follow_update_timer.start()
animated_sprite.play()
func _on_area_body_exited(body: Node2D) -> void:
if body is Player:
idle = true
target = null
follow_update_timer.stop()
animated_sprite.frame = 0
animated_sprite.stop()
func _on_attack_area_body_entered(body: Node2D) -> void:
if body is Player:
in_attack_range = true
attack_timer.start(attack_timer.wait_time + attack_cooldown_offset)
func _on_attack_area_body_exited(body: Node2D) -> void:
if body is Player:
in_attack_range = false
attack_timer.stop()
func _physics_process(delta: float) -> void:
if !idle && target:
if !navigation_agent_2d.is_navigation_finished():
var next_path_pos: Vector2 = navigation_agent_2d.get_next_path_position()
var direction: Vector2 = (next_path_pos - global_position).normalized()
var desired_velocity: Vector2 = direction * speed * delta
navigation_agent_2d.set_velocity(desired_velocity)
else:
velocity = Vector2.ZERO
move_and_slide()
else:
velocity = Vector2.ZERO
move_and_slide()
func _on_follow_update_timer_timeout() -> void:
if target && !idle:
navigation_agent_2d.target_position = target.global_position
func _on_navigation_agent2d_velocity_computed(safe_velocity: Vector2) -> void:
velocity = safe_velocity
move_and_slide()
func _on_attack_timer_timeout() -> void:
if target && in_attack_range:
target.health -= DAMAGE
func _on_fightable_fought(player: Player) -> void:
health -= player.damage
flicker_timer = flicker_time
if health <= 0:
queue_free()

View File

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

6
scripts/fightable.gd Normal file
View File

@@ -0,0 +1,6 @@
class_name Fightable
extends Area2D
signal fought(player: Player)
func fight(player: Player) -> void: fought.emit(player)

1
scripts/fightable.gd.uid Normal file
View File

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

View File

@@ -6,4 +6,5 @@ extends Node2D
func _ready() -> void: $Interactable.auto_interact = auto_interact func _ready() -> void: $Interactable.auto_interact = auto_interact
func _on_interacted(_player: Player) -> void: func _on_interacted(_player: Player) -> void:
EventManager.transition_scene_file(scene) if !scene.is_empty():
EventManager.transition_scene_file(scene)

View File

@@ -0,0 +1,34 @@
@tool
class_name Hearts
extends Control
@export_range(0, 10, 1) var health: int = 10:
set(value):
health = clamp(value, 0, max_health)
update_health_textures()
var max_health: int = 10
var heart_textures: Array[Node]
func _ready() -> void:
heart_textures = $HeartContainer.get_children()
for heart_texture in heart_textures:
heart_texture.texture = heart_texture.texture.duplicate()
update_health_textures()
func update_health_textures() -> void:
@warning_ignore("integer_division")
var full_hearts: int = health / 2
var half_heart: bool = health % 2 == 1
for i in range(heart_textures.size()):
var heart_texture: TextureRect = heart_textures[i]
var atlas: AtlasTexture = heart_texture.texture as AtlasTexture
if i < full_hearts:
atlas.region.position.x = 1
heart_texture.visible = true
elif i == full_hearts and half_heart:
atlas.region.position.x = 17
heart_texture.visible = true
else:
heart_texture.visible = false

View File

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

View File

@@ -1,18 +1,22 @@
class_name Player class_name Player
extends CharacterBody2D extends CharacterBody2D
const SPEED: int = 800 const SPEED: int = 1000
@onready var animated_sprite: AnimatedSprite2D = $AnimatedSprite2D @onready var animated_sprite: AnimatedSprite2D = $AnimatedSprite2D
@onready var fight_animation: AnimatedSprite2D = $FightAnimation
@onready var cam: Camera2D = $Camera2D @onready var cam: Camera2D = $Camera2D
@onready var raycast: RayCast2D = $RayCast2D @onready var raycast: RayCast2D = $RayCast2D
const RAYCAST_RAGE: int = 32 @onready var cursor_hide_timer: Timer = $CursorHideTimer
const RAYCAST_RANGE: int = 22
@export var tilemap: TileMapLayer @export var tilemap: TileMapLayer
var tilesize: int = 32 var tilesize: int = 32
var position_limit_rect: Rect2 var position_limit_rect: Rect2
const STILL_POSITIONS: Array[String] = ["sit", "hand_down", "hand_side", "hand_up"] const STILL_POSITIONS: Array[String] = ["sit_down", "sit_side", "hand_down", "hand_side", "hand_up"]
var health: int = 10
var damage: int = 2
func _ready() -> void: func _ready() -> void:
EventManager.player = self EventManager.player = self
@@ -35,9 +39,55 @@ func _ready() -> void:
) )
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
if EventManager.player_free && !EventManager.animation_player.is_playing() && Input.is_action_just_pressed("interact") && raycast.is_colliding() && raycast.get_collider() is Interactable: if EventManager.player_free && !EventManager.animation_player.is_playing() && Input.is_action_just_pressed("interact"):
var interactable: Interactable = raycast.get_collider() interact()
func interact() -> void:
var interactable: Interactable
if raycast.is_colliding() && raycast.get_collider() is Interactable:
interactable = raycast.get_collider()
else:
interactable = null
var fightable: Fightable
if raycast.is_colliding() && raycast.get_collider() is Fightable:
fightable = raycast.get_collider()
else:
fightable = null
match animated_sprite.animation:
"down":
animated_sprite.play("hand_down")
if interactable == null:
fight_animation.rotation_degrees = 0
fight_animation.play()
if !fight_animation.is_playing():
fight_animation.play()
await animated_sprite.animation_finished
animated_sprite.animation = "down"
"up":
animated_sprite.play("hand_up")
if interactable == null:
fight_animation.rotation_degrees = 180
fight_animation.play()
if !fight_animation.is_playing():
fight_animation.play()
await animated_sprite.animation_finished
animated_sprite.animation = "up"
"side":
animated_sprite.play("hand_side")
if interactable == null:
if animated_sprite.flip_h:
fight_animation.rotation_degrees = 90
else:
fight_animation.rotation_degrees = -90
if !fight_animation.is_playing():
fight_animation.play()
await animated_sprite.animation_finished
animated_sprite.animation = "side"
if interactable != null:
interactable.interact(self) interactable.interact(self)
elif fightable != null:
fightable.fight(self)
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
if !STILL_POSITIONS.has(animated_sprite.animation) && EventManager.player_free && !EventManager.animation_player.is_playing(): if !STILL_POSITIONS.has(animated_sprite.animation) && EventManager.player_free && !EventManager.animation_player.is_playing():
@@ -49,7 +99,7 @@ func _physics_process(delta: float) -> void:
elif abs(input.y) > 0: elif abs(input.y) > 0:
raycast_input.y = sign(input.y) raycast_input.y = sign(input.y)
if raycast_input != Vector2.ZERO: if raycast_input != Vector2.ZERO:
raycast.target_position = raycast_input * RAYCAST_RAGE raycast.target_position = raycast_input * RAYCAST_RANGE
velocity = input * delta * SPEED * 3 velocity = input * delta * SPEED * 3
@@ -71,6 +121,10 @@ func _physics_process(delta: float) -> void:
func _unhandled_input(event: InputEvent) -> void: func _unhandled_input(event: InputEvent) -> void:
if event is InputEventMouse: if event is InputEventMouse:
cursor_hide_timer.stop()
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
elif EventManager.player_free && !EventManager.animation_player.is_playing() && !event.is_action("escape"): elif EventManager.player_free && !EventManager.animation_player.is_playing() && !event.is_action("escape"):
if cursor_hide_timer.is_stopped():
cursor_hide_timer.start()
await cursor_hide_timer.timeout
Input.mouse_mode = Input.MOUSE_MODE_HIDDEN Input.mouse_mode = Input.MOUSE_MODE_HIDDEN