diff --git a/Assets/Spritesheets/Farmer_Pants_1_Black.png b/Assets/Spritesheets/Farmer_Pants_1_Black.png deleted file mode 100644 index e499505..0000000 Binary files a/Assets/Spritesheets/Farmer_Pants_1_Black.png and /dev/null differ diff --git a/Assets/Spritesheets/Farmer_Pants_1_Black.png.import b/Assets/Spritesheets/Farmer_Pants_1_Black.png.import deleted file mode 100644 index e643fa4..0000000 --- a/Assets/Spritesheets/Farmer_Pants_1_Black.png.import +++ /dev/null @@ -1,40 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://lqrfxvrdc4qq" -path="res://.godot/imported/Farmer_Pants_1_Black.png-15e7c43d1c5fcd845f700269afa2515d.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://Assets/Spritesheets/Farmer_Pants_1_Black.png" -dest_files=["res://.godot/imported/Farmer_Pants_1_Black.png-15e7c43d1c5fcd845f700269afa2515d.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 diff --git a/Assets/Spritesheets/Farmer_Shirt_1_Black.png b/Assets/Spritesheets/Farmer_Shirt_1_Black.png deleted file mode 100644 index e2b31d2..0000000 Binary files a/Assets/Spritesheets/Farmer_Shirt_1_Black.png and /dev/null differ diff --git a/Assets/Spritesheets/Farmer_Shirt_1_Black.png.import b/Assets/Spritesheets/Farmer_Shirt_1_Black.png.import deleted file mode 100644 index 835b21b..0000000 --- a/Assets/Spritesheets/Farmer_Shirt_1_Black.png.import +++ /dev/null @@ -1,40 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://4mpha6wuvyfy" -path="res://.godot/imported/Farmer_Shirt_1_Black.png-8b1dcf36a150d6b480fd95c8990539fe.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://Assets/Spritesheets/Farmer_Shirt_1_Black.png" -dest_files=["res://.godot/imported/Farmer_Shirt_1_Black.png-8b1dcf36a150d6b480fd95c8990539fe.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 diff --git a/Assets/Spritesheets/Hair_1_Blonde.png b/Assets/Spritesheets/Hair_1_Blonde.png deleted file mode 100644 index 6b14a80..0000000 Binary files a/Assets/Spritesheets/Hair_1_Blonde.png and /dev/null differ diff --git a/Assets/Spritesheets/Hair_1_Blonde.png.import b/Assets/Spritesheets/Hair_1_Blonde.png.import deleted file mode 100644 index de2737b..0000000 --- a/Assets/Spritesheets/Hair_1_Blonde.png.import +++ /dev/null @@ -1,40 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://1g5dx0dbupwk" -path="res://.godot/imported/Hair_1_Blonde.png-e93c90625ead2d832d7ef1b83045cb77.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://Assets/Spritesheets/Hair_1_Blonde.png" -dest_files=["res://.godot/imported/Hair_1_Blonde.png-e93c90625ead2d832d7ef1b83045cb77.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 diff --git a/Assets/Spritesheets/Hands_1_Bare.png b/Assets/Spritesheets/Hands_1_Bare.png deleted file mode 100644 index b66aad1..0000000 Binary files a/Assets/Spritesheets/Hands_1_Bare.png and /dev/null differ diff --git a/Assets/Spritesheets/Hands_1_Bare.png.import b/Assets/Spritesheets/Hands_1_Bare.png.import deleted file mode 100644 index a108da9..0000000 --- a/Assets/Spritesheets/Hands_1_Bare.png.import +++ /dev/null @@ -1,40 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://b1yikmomtafpg" -path="res://.godot/imported/Hands_1_Bare.png-5e14424b29c52ecfcfe6e04a36bdd9d4.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://Assets/Spritesheets/Hands_1_Bare.png" -dest_files=["res://.godot/imported/Hands_1_Bare.png-5e14424b29c52ecfcfe6e04a36bdd9d4.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 diff --git a/Assets/Spritesheets/Player_Base_animations.png b/Assets/Spritesheets/Player_Base_animations.png deleted file mode 100644 index 4f1fa27..0000000 Binary files a/Assets/Spritesheets/Player_Base_animations.png and /dev/null differ diff --git a/Assets/Spritesheets/Player_Base_animations.png.import b/Assets/Spritesheets/Player_Base_animations.png.import deleted file mode 100644 index ac68ec5..0000000 --- a/Assets/Spritesheets/Player_Base_animations.png.import +++ /dev/null @@ -1,40 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://de0ihg453ruyi" -path="res://.godot/imported/Player_Base_animations.png-af4aa0d38534a90566ea24fc25956ca2.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://Assets/Spritesheets/Player_Base_animations.png" -dest_files=["res://.godot/imported/Player_Base_animations.png-af4aa0d38534a90566ea24fc25956ca2.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 diff --git a/Assets/Spritesheets/Shoes_1_Black.png b/Assets/Spritesheets/Shoes_1_Black.png deleted file mode 100644 index 2796f86..0000000 Binary files a/Assets/Spritesheets/Shoes_1_Black.png and /dev/null differ diff --git a/Assets/Spritesheets/Shoes_1_Black.png.import b/Assets/Spritesheets/Shoes_1_Black.png.import deleted file mode 100644 index 09bc253..0000000 --- a/Assets/Spritesheets/Shoes_1_Black.png.import +++ /dev/null @@ -1,40 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://dw03nnfxdpb85" -path="res://.godot/imported/Shoes_1_Black.png-f4d9e6fa7fc208e65e537b49e204cfda.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://Assets/Spritesheets/Shoes_1_Black.png" -dest_files=["res://.godot/imported/Shoes_1_Black.png-f4d9e6fa7fc208e65e537b49e204cfda.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 diff --git a/Scenes/Characters/Player/player.tscn b/Scenes/Characters/Player/player.tscn index ee952aa..87a84ed 100644 --- a/Scenes/Characters/Player/player.tscn +++ b/Scenes/Characters/Player/player.tscn @@ -2,18 +2,59 @@ [ext_resource type="PackedScene" uid="uid://uyl0s1e67x6s" path="res://Scenes/Characters/Player/sprite.tscn" id="1_27cb7"] [ext_resource type="PackedScene" uid="uid://c2ydbmmvnfca6" path="res://Scenes/Characters/Player/state_machine.tscn" id="1_lyjr2"] -[ext_resource type="Script" uid="uid://b0l02v61if6k8" path="res://Scripts/Components/FacingDirectionComponent.gd" id="1_siygm"] +[ext_resource type="Script" uid="uid://dacvayqstkvws" path="res://Scripts/Characters/Player/player.gd" id="1_qqvsf"] +[ext_resource type="Script" uid="uid://b0l02v61if6k8" path="res://Scripts/Components/facing_direction_component.gd" id="1_siygm"] +[ext_resource type="Script" uid="uid://dwclkwbig1uii" path="res://Scripts/Characters/Player/movement_component.gd" id="4_apx8m"] +[ext_resource type="Script" uid="uid://brlisuoocwehh" path="res://Scripts/Characters/Player/interact_scanner.gd" id="6_fu1fx"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_apx8m"] +size = Vector2(9, 5) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_fu1fx"] +size = Vector2(6, 5) [node name="Player" type="CharacterBody2D" unique_id=1502234578] +script = ExtResource("1_qqvsf") [node name="Components" type="Node" parent="." unique_id=567893784] [node name="FacingDirectionComponent" type="Node" parent="Components" unique_id=408127032] script = ExtResource("1_siygm") -current_direction = 0 [node name="StateMachine" parent="." unique_id=732559774 instance=ExtResource("1_lyjr2")] +[node name="Idle State" type="Node" parent="StateMachine" unique_id=2017409248] + +[node name="Walking State" type="Node" parent="StateMachine" unique_id=1661048365] + +[node name="MovementComponent" type="Node" parent="." unique_id=1773880772 node_paths=PackedStringArray("body")] +script = ExtResource("4_apx8m") +body = NodePath("..") + [node name="Sprite" parent="." unique_id=1169131604 node_paths=PackedStringArray("state_machine", "direction_component") instance=ExtResource("1_27cb7")] state_machine = NodePath("../StateMachine") direction_component = NodePath("../Components/FacingDirectionComponent") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=495465356] +position = Vector2(-0.5, 4.5) +shape = SubResource("RectangleShape2D_apx8m") + +[node name="Marker2D" type="Marker2D" parent="." unique_id=2003544808] + +[node name="InteractScanner" type="Area2D" parent="Marker2D" unique_id=408353807 node_paths=PackedStringArray("parent", "direction_component")] +collision_layer = 0 +collision_mask = 2 +script = ExtResource("6_fu1fx") +parent = NodePath("..") +direction_component = NodePath("../../Components/FacingDirectionComponent") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Marker2D/InteractScanner" unique_id=1274307485] +position = Vector2(0, 9.5) +shape = SubResource("RectangleShape2D_fu1fx") +debug_color = Color(0.79959095, 0.41617078, 0.18507844, 0.41960785) + +[connection signal="DirectionChanged" from="Components/FacingDirectionComponent" to="Sprite" method="UpdateSprite"] +[connection signal="DirectionChanged" from="Components/FacingDirectionComponent" to="Marker2D/InteractScanner" method="OnDirectionChanged"] +[connection signal="MovementPerformed" from="MovementComponent" to="Components/FacingDirectionComponent" method="ChangeDirectionUsingMovementVector"] +[connection signal="area_entered" from="Marker2D/InteractScanner" to="." method="_on_interact_scanner_area_entered"] +[connection signal="area_exited" from="Marker2D/InteractScanner" to="." method="_on_interact_scanner_area_exited"] diff --git a/Scenes/Characters/Player/sprite.tscn b/Scenes/Characters/Player/sprite.tscn index 237d21f..0c4d9b8 100644 --- a/Scenes/Characters/Player/sprite.tscn +++ b/Scenes/Characters/Player/sprite.tscn @@ -1,12 +1,12 @@ [gd_scene format=3 uid="uid://uyl0s1e67x6s"] -[ext_resource type="Texture2D" uid="uid://de0ihg453ruyi" path="res://Assets/Spritesheets/Player_Base_animations.png" id="1_45g06"] +[ext_resource type="Texture2D" uid="uid://de0ihg453ruyi" path="res://Assets/Spritesheets/Player/Player_Base_animations.png" id="1_45g06"] [ext_resource type="Script" uid="uid://cuar23q48cbja" path="res://Scripts/Characters/Player/sprite.gd" id="1_jqxwg"] -[ext_resource type="Texture2D" uid="uid://1g5dx0dbupwk" path="res://Assets/Spritesheets/Hair_1_Blonde.png" id="2_jqxwg"] -[ext_resource type="Texture2D" uid="uid://4mpha6wuvyfy" path="res://Assets/Spritesheets/Farmer_Shirt_1_Black.png" id="3_ndjja"] -[ext_resource type="Texture2D" uid="uid://lqrfxvrdc4qq" path="res://Assets/Spritesheets/Farmer_Pants_1_Black.png" id="4_nwemi"] -[ext_resource type="Texture2D" uid="uid://b1yikmomtafpg" path="res://Assets/Spritesheets/Hands_1_Bare.png" id="5_jlj55"] -[ext_resource type="Texture2D" uid="uid://dw03nnfxdpb85" path="res://Assets/Spritesheets/Shoes_1_Black.png" id="6_h1kk7"] +[ext_resource type="Texture2D" uid="uid://1g5dx0dbupwk" path="res://Assets/Spritesheets/Player/Hair_1_Blonde.png" id="2_jqxwg"] +[ext_resource type="Texture2D" uid="uid://4mpha6wuvyfy" path="res://Assets/Spritesheets/Player/Farmer_Shirt_1_Black.png" id="3_ndjja"] +[ext_resource type="Texture2D" uid="uid://lqrfxvrdc4qq" path="res://Assets/Spritesheets/Player/Farmer_Pants_1_Black.png" id="4_nwemi"] +[ext_resource type="Texture2D" uid="uid://b1yikmomtafpg" path="res://Assets/Spritesheets/Player/Hands_1_Bare.png" id="5_jlj55"] +[ext_resource type="Texture2D" uid="uid://dw03nnfxdpb85" path="res://Assets/Spritesheets/Player/Shoes_1_Black.png" id="6_h1kk7"] [sub_resource type="AtlasTexture" id="AtlasTexture_40svl"] atlas = ExtResource("1_45g06") @@ -56,6 +56,54 @@ region = Rect2(256, 64, 64, 64) atlas = ExtResource("1_45g06") region = Rect2(320, 64, 64, 64) +[sub_resource type="AtlasTexture" id="AtlasTexture_ti3k1"] +atlas = ExtResource("1_45g06") +region = Rect2(0, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_hi03j"] +atlas = ExtResource("1_45g06") +region = Rect2(64, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_tc57j"] +atlas = ExtResource("1_45g06") +region = Rect2(128, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_jeian"] +atlas = ExtResource("1_45g06") +region = Rect2(192, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ixhh1"] +atlas = ExtResource("1_45g06") +region = Rect2(256, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_2e61i"] +atlas = ExtResource("1_45g06") +region = Rect2(320, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_q6o3u"] +atlas = ExtResource("1_45g06") +region = Rect2(0, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_p50vd"] +atlas = ExtResource("1_45g06") +region = Rect2(64, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4iviq"] +atlas = ExtResource("1_45g06") +region = Rect2(128, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_j52ws"] +atlas = ExtResource("1_45g06") +region = Rect2(192, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_g0abu"] +atlas = ExtResource("1_45g06") +region = Rect2(256, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_1cqqe"] +atlas = ExtResource("1_45g06") +region = Rect2(320, 192, 64, 64) + [sub_resource type="SpriteFrames" id="SpriteFrames_gdgf0"] animations = [{ "frames": [{ @@ -103,6 +151,52 @@ animations = [{ "loop": true, "name": &"idle-side", "speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_ti3k1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_hi03j") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_tc57j") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_jeian") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ixhh1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_2e61i") +}], +"loop": true, +"name": &"idle-up", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_q6o3u") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_p50vd") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4iviq") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_j52ws") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_g0abu") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_1cqqe") +}], +"loop": true, +"name": &"walking-down", +"speed": 5.0 }] [sub_resource type="AtlasTexture" id="AtlasTexture_gdgf0"] @@ -153,6 +247,54 @@ region = Rect2(256, 64, 64, 64) atlas = ExtResource("2_jqxwg") region = Rect2(320, 64, 64, 64) +[sub_resource type="AtlasTexture" id="AtlasTexture_vn16q"] +atlas = ExtResource("2_jqxwg") +region = Rect2(0, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_scebx"] +atlas = ExtResource("2_jqxwg") +region = Rect2(64, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_eerbr"] +atlas = ExtResource("2_jqxwg") +region = Rect2(128, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_8d07d"] +atlas = ExtResource("2_jqxwg") +region = Rect2(192, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_lkp70"] +atlas = ExtResource("2_jqxwg") +region = Rect2(256, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_mtldg"] +atlas = ExtResource("2_jqxwg") +region = Rect2(320, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_nvwtl"] +atlas = ExtResource("2_jqxwg") +region = Rect2(0, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_a6jr6"] +atlas = ExtResource("2_jqxwg") +region = Rect2(64, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_3okhw"] +atlas = ExtResource("2_jqxwg") +region = Rect2(128, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_riux0"] +atlas = ExtResource("2_jqxwg") +region = Rect2(192, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_0cac1"] +atlas = ExtResource("2_jqxwg") +region = Rect2(256, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_71e2u"] +atlas = ExtResource("2_jqxwg") +region = Rect2(320, 192, 64, 64) + [sub_resource type="SpriteFrames" id="SpriteFrames_xccyk"] animations = [{ "frames": [{ @@ -200,6 +342,52 @@ animations = [{ "loop": true, "name": &"idle-side", "speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_vn16q") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_scebx") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_eerbr") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_8d07d") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_lkp70") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_mtldg") +}], +"loop": true, +"name": &"idle-up", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_nvwtl") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_a6jr6") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_3okhw") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_riux0") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_0cac1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_71e2u") +}], +"loop": true, +"name": &"walking-down", +"speed": 5.0 }] [sub_resource type="AtlasTexture" id="AtlasTexture_h1n2f"] @@ -250,6 +438,54 @@ region = Rect2(256, 64, 64, 64) atlas = ExtResource("3_ndjja") region = Rect2(320, 64, 64, 64) +[sub_resource type="AtlasTexture" id="AtlasTexture_qwnuy"] +atlas = ExtResource("3_ndjja") +region = Rect2(0, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ne4mu"] +atlas = ExtResource("3_ndjja") +region = Rect2(64, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_wrx58"] +atlas = ExtResource("3_ndjja") +region = Rect2(128, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_iwujh"] +atlas = ExtResource("3_ndjja") +region = Rect2(192, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_1d458"] +atlas = ExtResource("3_ndjja") +region = Rect2(256, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ljrog"] +atlas = ExtResource("3_ndjja") +region = Rect2(320, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_dybbi"] +atlas = ExtResource("3_ndjja") +region = Rect2(0, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_v18rl"] +atlas = ExtResource("3_ndjja") +region = Rect2(64, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_he10o"] +atlas = ExtResource("3_ndjja") +region = Rect2(128, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_omkwr"] +atlas = ExtResource("3_ndjja") +region = Rect2(192, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_i380v"] +atlas = ExtResource("3_ndjja") +region = Rect2(256, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_kj0dk"] +atlas = ExtResource("3_ndjja") +region = Rect2(320, 192, 64, 64) + [sub_resource type="SpriteFrames" id="SpriteFrames_uxymp"] animations = [{ "frames": [{ @@ -297,6 +533,52 @@ animations = [{ "loop": true, "name": &"idle-side", "speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_qwnuy") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ne4mu") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_wrx58") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_iwujh") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_1d458") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ljrog") +}], +"loop": true, +"name": &"idle-up", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_dybbi") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_v18rl") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_he10o") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_omkwr") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_i380v") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_kj0dk") +}], +"loop": true, +"name": &"walking-down", +"speed": 5.0 }] [sub_resource type="AtlasTexture" id="AtlasTexture_fepmq"] @@ -347,6 +629,54 @@ region = Rect2(256, 64, 64, 64) atlas = ExtResource("4_nwemi") region = Rect2(320, 64, 64, 64) +[sub_resource type="AtlasTexture" id="AtlasTexture_16uao"] +atlas = ExtResource("4_nwemi") +region = Rect2(0, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4np5r"] +atlas = ExtResource("4_nwemi") +region = Rect2(64, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_pfc33"] +atlas = ExtResource("4_nwemi") +region = Rect2(128, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_7yfqj"] +atlas = ExtResource("4_nwemi") +region = Rect2(192, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_47bsp"] +atlas = ExtResource("4_nwemi") +region = Rect2(256, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_r4lu7"] +atlas = ExtResource("4_nwemi") +region = Rect2(320, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_dmmcj"] +atlas = ExtResource("4_nwemi") +region = Rect2(0, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_5vsd2"] +atlas = ExtResource("4_nwemi") +region = Rect2(64, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_n4v7b"] +atlas = ExtResource("4_nwemi") +region = Rect2(128, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_oetbr"] +atlas = ExtResource("4_nwemi") +region = Rect2(192, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_27fkc"] +atlas = ExtResource("4_nwemi") +region = Rect2(256, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_wvpty"] +atlas = ExtResource("4_nwemi") +region = Rect2(320, 192, 64, 64) + [sub_resource type="SpriteFrames" id="SpriteFrames_inlw8"] animations = [{ "frames": [{ @@ -394,6 +724,52 @@ animations = [{ "loop": true, "name": &"idle-side", "speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_16uao") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4np5r") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_pfc33") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_7yfqj") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_47bsp") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_r4lu7") +}], +"loop": true, +"name": &"idle-up", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_dmmcj") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_5vsd2") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_n4v7b") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_oetbr") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_27fkc") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_wvpty") +}], +"loop": true, +"name": &"walking-down", +"speed": 5.0 }] [sub_resource type="AtlasTexture" id="AtlasTexture_xccyk"] @@ -444,6 +820,54 @@ region = Rect2(256, 64, 64, 64) atlas = ExtResource("5_jlj55") region = Rect2(320, 64, 64, 64) +[sub_resource type="AtlasTexture" id="AtlasTexture_jhp1c"] +atlas = ExtResource("5_jlj55") +region = Rect2(0, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ai5m2"] +atlas = ExtResource("5_jlj55") +region = Rect2(64, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_36bf3"] +atlas = ExtResource("5_jlj55") +region = Rect2(128, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_3er0e"] +atlas = ExtResource("5_jlj55") +region = Rect2(192, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_bfd1f"] +atlas = ExtResource("5_jlj55") +region = Rect2(256, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_j5cpq"] +atlas = ExtResource("5_jlj55") +region = Rect2(320, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_3uto3"] +atlas = ExtResource("5_jlj55") +region = Rect2(0, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ji3iq"] +atlas = ExtResource("5_jlj55") +region = Rect2(64, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_265a2"] +atlas = ExtResource("5_jlj55") +region = Rect2(128, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_gp83o"] +atlas = ExtResource("5_jlj55") +region = Rect2(192, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_n6nmt"] +atlas = ExtResource("5_jlj55") +region = Rect2(256, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_u2uyx"] +atlas = ExtResource("5_jlj55") +region = Rect2(320, 192, 64, 64) + [sub_resource type="SpriteFrames" id="SpriteFrames_m75h8"] animations = [{ "frames": [{ @@ -491,6 +915,52 @@ animations = [{ "loop": true, "name": &"idle-side", "speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_jhp1c") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ai5m2") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_36bf3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_3er0e") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_bfd1f") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_j5cpq") +}], +"loop": true, +"name": &"idle-up", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_3uto3") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ji3iq") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_265a2") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_gp83o") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_n6nmt") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_u2uyx") +}], +"loop": true, +"name": &"walking-down", +"speed": 5.0 }] [sub_resource type="AtlasTexture" id="AtlasTexture_m75h8"] @@ -541,6 +1011,54 @@ region = Rect2(256, 64, 64, 64) atlas = ExtResource("6_h1kk7") region = Rect2(320, 64, 64, 64) +[sub_resource type="AtlasTexture" id="AtlasTexture_kky8u"] +atlas = ExtResource("6_h1kk7") +region = Rect2(0, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_na1uy"] +atlas = ExtResource("6_h1kk7") +region = Rect2(64, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_xs0vh"] +atlas = ExtResource("6_h1kk7") +region = Rect2(128, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ahq22"] +atlas = ExtResource("6_h1kk7") +region = Rect2(192, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_drsie"] +atlas = ExtResource("6_h1kk7") +region = Rect2(256, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_16k30"] +atlas = ExtResource("6_h1kk7") +region = Rect2(320, 128, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_eiiah"] +atlas = ExtResource("6_h1kk7") +region = Rect2(0, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_famop"] +atlas = ExtResource("6_h1kk7") +region = Rect2(64, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_sdg35"] +atlas = ExtResource("6_h1kk7") +region = Rect2(128, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_8plvv"] +atlas = ExtResource("6_h1kk7") +region = Rect2(192, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_jcstq"] +atlas = ExtResource("6_h1kk7") +region = Rect2(256, 192, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_f3npj"] +atlas = ExtResource("6_h1kk7") +region = Rect2(320, 192, 64, 64) + [sub_resource type="SpriteFrames" id="SpriteFrames_2davj"] animations = [{ "frames": [{ @@ -588,6 +1106,52 @@ animations = [{ "loop": true, "name": &"idle-side", "speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_kky8u") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_na1uy") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_xs0vh") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ahq22") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_drsie") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_16k30") +}], +"loop": true, +"name": &"idle-up", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_eiiah") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_famop") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_sdg35") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_8plvv") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_jcstq") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_f3npj") +}], +"loop": true, +"name": &"walking-down", +"speed": 5.0 }] [node name="Sprite" type="Node2D" unique_id=1169131604] @@ -595,30 +1159,30 @@ script = ExtResource("1_jqxwg") [node name="Base" type="AnimatedSprite2D" parent="." unique_id=2054948028] sprite_frames = SubResource("SpriteFrames_gdgf0") -animation = &"idle-side" +animation = &"walking-down" autoplay = "idle-down" [node name="Hair" type="AnimatedSprite2D" parent="." unique_id=231591242] sprite_frames = SubResource("SpriteFrames_xccyk") -animation = &"idle-side" +animation = &"walking-down" autoplay = "idle-down" [node name="Shirt" type="AnimatedSprite2D" parent="." unique_id=973518035] sprite_frames = SubResource("SpriteFrames_uxymp") -animation = &"idle-side" +animation = &"walking-down" autoplay = "idle-down" [node name="Pants" type="AnimatedSprite2D" parent="." unique_id=1239862223] sprite_frames = SubResource("SpriteFrames_inlw8") -animation = &"idle-side" +animation = &"walking-down" autoplay = "idle-down" [node name="Hands" type="AnimatedSprite2D" parent="." unique_id=1598152304] sprite_frames = SubResource("SpriteFrames_m75h8") -animation = &"idle-side" +animation = &"walking-down" autoplay = "idle-down" [node name="Shoes" type="AnimatedSprite2D" parent="." unique_id=482154148] sprite_frames = SubResource("SpriteFrames_2davj") -animation = &"idle-side" +animation = &"walking-down" autoplay = "idle-down" diff --git a/Scenes/shop.tscn b/Scenes/shop.tscn deleted file mode 100644 index 715eacc..0000000 --- a/Scenes/shop.tscn +++ /dev/null @@ -1,12 +0,0 @@ -[gd_scene format=3 uid="uid://bwt0ijoq4qmhn"] - -[ext_resource type="PackedScene" uid="uid://6athlweutl2g" path="res://Scenes/Characters/Player/player.tscn" id="1_a0mxf"] - -[node name="Shop" type="Node2D" unique_id=547318403] - -[node name="Player" parent="." unique_id=1502234578 instance=ExtResource("1_a0mxf")] -position = Vector2(289, 174) - -[node name="Camera2D" type="Camera2D" parent="." unique_id=1684491254] -position = Vector2(307, 165) -zoom = Vector2(3, 3) diff --git a/Scripts/Characters/Player/sprite.gd b/Scripts/Characters/Player/sprite.gd index 298e261..3e40d4f 100644 --- a/Scripts/Characters/Player/sprite.gd +++ b/Scripts/Characters/Player/sprite.gd @@ -10,6 +10,26 @@ extends Node2D @onready var shoes: AnimatedSprite2D = $Shoes var all_parts: Array[AnimatedSprite2D] +var current_animation := "idle-down" +var is_flipped := false + +# Public Methods +func UpdateSprite() -> void: + var current_state := state_machine.GetCurrentState() + var current_direction := direction_component.GetCurrentDirection() + var animation := _build_animation_name(current_state, current_direction) + var should_flip := _should_flip_horizontal() + + if animation == current_animation and should_flip == is_flipped: + return + + current_animation = animation + is_flipped = should_flip + + for part in all_parts: + part.animation = animation + part.play() + part.flip_h = should_flip # Called when the node enters the scene tree for the first time. func _ready() -> void: @@ -17,12 +37,7 @@ func _ready() -> void: base, hair, pants, hands, shoes ] - var animation := _build_animation_name(state_machine.GetCurrentState(), direction_component.GetCurrentDirection()) - var should_flip := _should_flip_horizontal() - for part in all_parts: - part.animation = animation - part.play() - part.flip_h = should_flip + UpdateSprite() func _build_animation_name(state: PlayerStateMachine.States, direction: Enums.Directions) -> String: diff --git a/Scripts/Characters/Player/state_machine.gd b/Scripts/Characters/Player/state_machine.gd index 008c2db..7eaa374 100644 --- a/Scripts/Characters/Player/state_machine.gd +++ b/Scripts/Characters/Player/state_machine.gd @@ -15,5 +15,5 @@ func _ready() -> void: # Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: +func _process(_delta: float) -> void: pass diff --git a/Scripts/Components/FacingDirectionComponent.gd b/Scripts/Components/FacingDirectionComponent.gd deleted file mode 100644 index 48c4fb6..0000000 --- a/Scripts/Components/FacingDirectionComponent.gd +++ /dev/null @@ -1,8 +0,0 @@ -extends Node -class_name FacingDirectionComponent - -@export var current_direction := Enums.Directions.DOWN - -# Public Methods -func GetCurrentDirection() -> Enums.Directions: - return current_direction diff --git a/Scripts/Components/FacingDirectionComponent.gd.uid b/Scripts/Components/FacingDirectionComponent.gd.uid deleted file mode 100644 index 726d694..0000000 --- a/Scripts/Components/FacingDirectionComponent.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://b0l02v61if6k8 diff --git a/Scripts/enums.gd b/Scripts/enums.gd index 42170c0..6c2a689 100644 --- a/Scripts/enums.gd +++ b/Scripts/enums.gd @@ -3,3 +3,14 @@ extends Node enum Directions { LEFT, RIGHT, UP, DOWN } + +enum CheckLocations { + SHOP_1, SHOP_2, SHOP_3 +} + +enum Items { + BRONZE_KEY, SILVER_KEY, GOLD_KEY, + WOOD_SWORD, IRON_SWORD, ROYAL_SWORD, + RED_POTION, + GOLD_100, GOLD_200, GOLD_300, GOLD_400 +} diff --git a/project.godot b/project.godot index 4e88c36..d5ffae6 100644 --- a/project.godot +++ b/project.godot @@ -18,6 +18,11 @@ config/icon="res://icon.svg" [autoload] Enums="*uid://bfddgy6gohdj3" +GameManager="*uid://cb4tuxriixfqs" + +[layer_names] + +2d_physics/layer_2="Interaction" [physics]