diff --git a/Assets/Aseprite Files/Under Construction.aseprite b/Assets/Aseprite Files/Under Construction.aseprite new file mode 100644 index 0000000..322547c Binary files /dev/null and b/Assets/Aseprite Files/Under Construction.aseprite differ diff --git a/Assets/Sprites/Under Construction.png b/Assets/Sprites/Under Construction.png new file mode 100644 index 0000000..59b115f Binary files /dev/null and b/Assets/Sprites/Under Construction.png differ diff --git a/Assets/Sprites/Under Construction.png.import b/Assets/Sprites/Under Construction.png.import new file mode 100644 index 0000000..0e6d103 --- /dev/null +++ b/Assets/Sprites/Under Construction.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://2euqjppqk8s5" +path="res://.godot/imported/Under Construction.png-79dfb273934f7b52415afe779e8bb24b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Sprites/Under Construction.png" +dest_files=["res://.godot/imported/Under Construction.png-79dfb273934f7b52415afe779e8bb24b.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/Resources/Dialogue/.~lock.Archipelago Game - Translation.ods# b/Resources/Dialogue/.~lock.Archipelago Game - Translation.ods# deleted file mode 100644 index 70f2756..0000000 --- a/Resources/Dialogue/.~lock.Archipelago Game - Translation.ods# +++ /dev/null @@ -1 +0,0 @@ -,caleb,caleb-B550-UD-AC,13.03.2026 15:34,file:///home/caleb/.config/libreoffice/4; \ No newline at end of file diff --git a/Resources/Dialogue/Archipelago Game - Translation.csv b/Resources/Dialogue/Archipelago Game - Translation.csv index 9dfd064..c37e47e 100644 --- a/Resources/Dialogue/Archipelago Game - Translation.csv +++ b/Resources/Dialogue/Archipelago Game - Translation.csv @@ -2,3 +2,4 @@ key,en,nl MSG_FOREST_DUNGEON_ENTRANCE_PATH_TO_DUNGEON_01_SIGN_01,WARNING: Dangerous Monsters Ahead!,TODO MSG_FOREST_DUNGEON_ENTRANCE_HOME_01_LOCKED_CHEST_01,It’s locked… What could the blacksmith be hiding?,TODO MSG_CHEST_ALREADY_OPENED,The chest is empty…,TODO +MSG_BLACKSMITH,"Welcome to my home. I don’t get many visitors out here.’s difficult to get materials out here. Hey, could you bring me some metal ore if you stumble upon any?You won’t go unrewarded!",TODO diff --git a/Resources/Dialogue/Archipelago Game - Translation.ods b/Resources/Dialogue/Archipelago Game - Translation.ods index 7af8bf2..195f655 100644 Binary files a/Resources/Dialogue/Archipelago Game - Translation.ods and b/Resources/Dialogue/Archipelago Game - Translation.ods differ diff --git a/Scenes/Characters/Player/player.tscn b/Scenes/Characters/Player/player.tscn index 7148879..09c9fef 100644 --- a/Scenes/Characters/Player/player.tscn +++ b/Scenes/Characters/Player/player.tscn @@ -13,6 +13,7 @@ [ext_resource type="Script" uid="uid://cd2ewadcm8oi5" path="res://Scripts/Characters/Player/States/firing_arrow_state.gd" id="8_plevq"] [ext_resource type="Script" uid="uid://bx1a35al4yiej" path="res://Scripts/Characters/Player/States/sitting_state.gd" id="9_sdxbo"] [ext_resource type="Script" uid="uid://bnontuqj3cnom" path="res://Scripts/Characters/Player/States/cutscene_state.gd" id="10_p06rw"] +[ext_resource type="Script" uid="uid://wfdtd3xlgrvm" path="res://Scripts/Characters/Player/States/play_animation_state.gd" id="12_aencf"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_apx8m"] size = Vector2(10, 5) @@ -23,9 +24,11 @@ radius = 12.0 [sub_resource type="RectangleShape2D" id="RectangleShape2D_fu1fx"] size = Vector2(6, 5) -[node name="Player" type="CharacterBody2D" unique_id=1502234578 groups=["Player Group"]] +[node name="Player" type="CharacterBody2D" unique_id=1502234578 node_paths=PackedStringArray("player_sprite", "state_machine") groups=["Player Group"]] y_sort_enabled = true script = ExtResource("1_qqvsf") +player_sprite = NodePath("Player Sprite") +state_machine = NodePath("State Machine") [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=495465356] position = Vector2(0, 4.5) @@ -36,53 +39,57 @@ shape = SubResource("RectangleShape2D_apx8m") [node name="FacingDirectionComponent" type="Node" parent="Components" unique_id=408127032] script = ExtResource("1_siygm") -[node name="StateMachine" parent="." unique_id=732559774 node_paths=PackedStringArray("states_container", "current_state") instance=ExtResource("1_lyjr2")] +[node name="MovementComponent" type="Node" parent="Components" unique_id=1773880772 node_paths=PackedStringArray("body")] +script = ExtResource("4_apx8m") +body = NodePath("../..") + +[node name="State Machine" parent="." unique_id=732559774 node_paths=PackedStringArray("states_container", "current_state") instance=ExtResource("1_lyjr2")] states_container = NodePath("States") current_state = NodePath("States/Idle State") -[node name="States" type="Node" parent="StateMachine" unique_id=1171587216] +[node name="States" type="Node" parent="State Machine" unique_id=1171587216] -[node name="Idle State" type="Node" parent="StateMachine/States" unique_id=2017409248 node_paths=PackedStringArray("movement_component", "state_machine")] +[node name="Idle State" type="Node" parent="State Machine/States" unique_id=2017409248 node_paths=PackedStringArray("movement_component", "state_machine")] script = ExtResource("4_dxcao") -movement_component = NodePath("../../../MovementComponent") +movement_component = NodePath("../../../Components/MovementComponent") state_machine = NodePath("../..") -[node name="Walking State" type="Node" parent="StateMachine/States" unique_id=1661048365 node_paths=PackedStringArray("movement_component", "direction_component", "body", "state_machine")] +[node name="Walking State" type="Node" parent="State Machine/States" unique_id=1661048365 node_paths=PackedStringArray("movement_component", "direction_component", "body", "state_machine")] script = ExtResource("5_cscr0") -movement_component = NodePath("../../../MovementComponent") +movement_component = NodePath("../../../Components/MovementComponent") direction_component = NodePath("../../../Components/FacingDirectionComponent") body = NodePath("../../..") state_machine = NodePath("../..") -[node name="Using Item A State" type="Node" parent="StateMachine/States" unique_id=1017153142 node_paths=PackedStringArray("body", "direction_component", "state_machine")] +[node name="Using Item A State" type="Node" parent="State Machine/States" unique_id=1017153142 node_paths=PackedStringArray("body", "direction_component", "state_machine")] script = ExtResource("5_1mdwi") body = NodePath("../../..") direction_component = NodePath("../../../Components/FacingDirectionComponent") state_machine = NodePath("../..") -[node name="Drawing Bow State" type="Node" parent="StateMachine/States" unique_id=317681716 node_paths=PackedStringArray("movement_componenent", "body", "state_machine")] +[node name="Drawing Bow State" type="Node" parent="State Machine/States" unique_id=317681716 node_paths=PackedStringArray("movement_componenent", "body", "state_machine")] script = ExtResource("7_cscr0") -movement_componenent = NodePath("../../../MovementComponent") +movement_componenent = NodePath("../../../Components/MovementComponent") body = NodePath("../../..") state_machine = NodePath("../..") -[node name="Firing Arrow State" type="Node" parent="StateMachine/States" unique_id=2129772816 node_paths=PackedStringArray("direction_component", "arrow_spawn_marker", "state_machine")] +[node name="Firing Arrow State" type="Node" parent="State Machine/States" unique_id=2129772816 node_paths=PackedStringArray("direction_component", "arrow_spawn_marker", "state_machine")] script = ExtResource("8_plevq") direction_component = NodePath("../../../Components/FacingDirectionComponent") arrow_spawn_marker = NodePath("../../../Marker2D") state_machine = NodePath("../..") -[node name="Sitting State" type="Node" parent="StateMachine/States" unique_id=1774602333 node_paths=PackedStringArray("state_machine")] +[node name="Sitting State" type="Node" parent="State Machine/States" unique_id=1774602333 node_paths=PackedStringArray("state_machine")] script = ExtResource("9_sdxbo") state_machine = NodePath("../..") -[node name="Cutscene State" type="Node" parent="StateMachine/States" unique_id=1722986400 node_paths=PackedStringArray("state_machine")] +[node name="Cutscene State" type="Node" parent="State Machine/States" unique_id=1722986400 node_paths=PackedStringArray("state_machine")] script = ExtResource("10_p06rw") state_machine = NodePath("../..") -[node name="MovementComponent" type="Node" parent="." unique_id=1773880772 node_paths=PackedStringArray("body")] -script = ExtResource("4_apx8m") -body = NodePath("..") +[node name="Play Animation State" type="Node" parent="State Machine/States" unique_id=1357816619 node_paths=PackedStringArray("state_machine")] +script = ExtResource("12_aencf") +state_machine = NodePath("../..") [node name="Occlusion Culling Area" type="Area2D" parent="." unique_id=1195961806] collision_layer = 8 @@ -92,7 +99,7 @@ collision_mask = 0 shape = SubResource("CircleShape2D_plevq") [node name="Player Sprite" parent="." unique_id=1169131604 node_paths=PackedStringArray("state_machine", "direction_component") instance=ExtResource("1_27cb7")] -state_machine = NodePath("../StateMachine") +state_machine = NodePath("../State Machine") direction_component = NodePath("../Components/FacingDirectionComponent") [node name="Marker2D" type="Marker2D" parent="." unique_id=2003544808] @@ -109,17 +116,20 @@ position = Vector2(0, 9.5) shape = SubResource("RectangleShape2D_fu1fx") debug_color = Color(0.79959095, 0.41617078, 0.18507844, 0.41960785) -[connection signal="CutsceneEnded" from="." to="StateMachine/States/Cutscene State" method="OnCutsceneEnded"] -[connection signal="CutsceneStarted" from="." to="StateMachine/States/Idle State" method="OnCutsceneStarted"] -[connection signal="SitOnFurnitureTriggered" from="." to="StateMachine/States/Idle State" method="OnSitOnFurnitureTriggered"] +[connection signal="CutsceneEnded" from="." to="State Machine/States/Cutscene State" method="OnCutsceneEnded"] +[connection signal="CutsceneStarted" from="." to="State Machine/States/Idle State" method="OnCutsceneStarted"] +[connection signal="SitOnFurnitureTriggered" from="." to="State Machine/States/Idle State" method="OnSitOnFurnitureTriggered"] [connection signal="DirectionChanged" from="Components/FacingDirectionComponent" to="Player Sprite" method="UpdateSprite"] [connection signal="DirectionChanged" from="Components/FacingDirectionComponent" to="Marker2D/InteractScanner" method="OnDirectionChanged"] -[connection signal="PlayerBecameIdle" from="StateMachine/States/Idle State" to="Player Sprite" method="UpdateSprite"] -[connection signal="PlayerBeganDrawingBow" from="StateMachine/States/Drawing Bow State" to="Player Sprite" method="UpdateSprite"] -[connection signal="PlayerBeganFiringArrow" from="StateMachine/States/Firing Arrow State" to="Player Sprite" method="UpdateSprite"] -[connection signal="PlayerFiredArrow" from="StateMachine/States/Firing Arrow State" to="." method="_on_using_item_a_state_arrow_fired"] -[connection signal="DrawingBowAnimationFinished" from="Player Sprite" to="StateMachine/States/Drawing Bow State" method="OnDrawingBowAnimationFinished"] -[connection signal="FiringArrowAnimationFinished" from="Player Sprite" to="StateMachine/States/Firing Arrow State" method="OnFiringArrowAnimationFinished"] +[connection signal="PlayerBecameIdle" from="State Machine/States/Idle State" to="Player Sprite" method="UpdateSprite"] +[connection signal="StartedWalking" from="State Machine/States/Walking State" to="Player Sprite" method="UpdateSprite"] +[connection signal="PlayerBeganDrawingBow" from="State Machine/States/Drawing Bow State" to="Player Sprite" method="UpdateSprite"] +[connection signal="PlayerBeganFiringArrow" from="State Machine/States/Firing Arrow State" to="Player Sprite" method="UpdateSprite"] +[connection signal="PlayerFiredArrow" from="State Machine/States/Firing Arrow State" to="." method="_on_using_item_a_state_arrow_fired"] +[connection signal="PlayAnimation" from="State Machine/States/Play Animation State" to="Player Sprite" method="PlaySpecifiedAnimation"] +[connection signal="AnimationFinished" from="Player Sprite" to="State Machine/States/Play Animation State" method="OnAnimationFinished"] +[connection signal="DrawingBowAnimationFinished" from="Player Sprite" to="State Machine/States/Drawing Bow State" method="OnDrawingBowAnimationFinished"] +[connection signal="FiringArrowAnimationFinished" from="Player Sprite" to="State Machine/States/Firing Arrow State" method="OnFiringArrowAnimationFinished"] [connection signal="InteractionActionTriggered" from="Marker2D/InteractScanner" to="." method="_on_interaction_action_triggered"] [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 e6a9855..d303a7a 100644 --- a/Scenes/Characters/Player/sprite.tscn +++ b/Scenes/Characters/Player/sprite.tscn @@ -153,6 +153,26 @@ region = Rect2(256, 128, 64, 64) atlas = ExtResource("2_ndjja") region = Rect2(320, 128, 64, 64) +[sub_resource type="AtlasTexture" id="AtlasTexture_e1olu"] +atlas = ExtResource("2_ndjja") +region = Rect2(0, 1280, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_jmdrl"] +atlas = ExtResource("2_ndjja") +region = Rect2(64, 1280, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_wk3mk"] +atlas = ExtResource("2_ndjja") +region = Rect2(128, 1280, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_8mpdo"] +atlas = ExtResource("2_ndjja") +region = Rect2(192, 1280, 64, 64) + +[sub_resource type="AtlasTexture" id="AtlasTexture_46inv"] +atlas = ExtResource("2_ndjja") +region = Rect2(256, 1280, 64, 64) + [sub_resource type="AtlasTexture" id="AtlasTexture_s6rq5"] atlas = ExtResource("2_ndjja") region = Rect2(0, 192, 64, 64) @@ -382,6 +402,26 @@ animations = [{ }, { "frames": [{ "duration": 1.0, +"texture": SubResource("AtlasTexture_e1olu") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_jmdrl") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_wk3mk") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_8mpdo") +}, { +"duration": 8.0, +"texture": SubResource("AtlasTexture_46inv") +}], +"loop": false, +"name": &"opening-chest-down", +"speed": 8.0 +}, { +"frames": [{ +"duration": 1.0, "texture": SubResource("AtlasTexture_s6rq5") }, { "duration": 1.0, @@ -1655,7 +1695,7 @@ script = ExtResource("1_jqxwg") [node name="Full" type="AnimatedSprite2D" parent="." unique_id=1296959783] position = Vector2(0, 7) sprite_frames = SubResource("SpriteFrames_jqxwg") -animation = &"idle-down" +animation = &"opening-chest-down" autoplay = "idle-down" offset = Vector2(0, -7) diff --git a/Scenes/Debug/under_construction_block.tscn b/Scenes/Debug/under_construction_block.tscn new file mode 100644 index 0000000..ec3d63f --- /dev/null +++ b/Scenes/Debug/under_construction_block.tscn @@ -0,0 +1,17 @@ +[gd_scene format=3 uid="uid://c7rjjlamkqhnw"] + +[ext_resource type="Texture2D" uid="uid://2euqjppqk8s5" path="res://Assets/Sprites/Under Construction.png" id="1_acm7k"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_wcsxr"] +size = Vector2(16, 16) + +[node name="Under Construction Block" type="StaticBody2D" unique_id=390553492] +texture_repeat = 2 +collision_mask = 0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=64334173] +shape = SubResource("RectangleShape2D_wcsxr") + +[node name="Sprite2D" type="Sprite2D" parent="." unique_id=291414072] +texture_repeat = 2 +texture = ExtResource("1_acm7k") diff --git a/Scenes/Maps/Forest Dungeon Entrance/Interiors/home_01.tscn b/Scenes/Maps/Forest Dungeon Entrance/Interiors/home_01.tscn index 9be4402..3c48ed9 100644 --- a/Scenes/Maps/Forest Dungeon Entrance/Interiors/home_01.tscn +++ b/Scenes/Maps/Forest Dungeon Entrance/Interiors/home_01.tscn @@ -14,6 +14,9 @@ [sub_resource type="RectangleShape2D" id="RectangleShape2D_7kg22"] size = Vector2(32, 8) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_ec540"] +size = Vector2(11, 18) + [sub_resource type="AtlasTexture" id="AtlasTexture_a58cd"] atlas = ExtResource("6_x3y8m") region = Rect2(0, 0, 64, 64) @@ -64,6 +67,9 @@ animations = [{ "speed": 5.0 }] +[sub_resource type="RectangleShape2D" id="RectangleShape2D_6xfm6"] +size = Vector2(11, 14) + [node name="Home 01" type="Node2D" unique_id=1401818514] y_sort_enabled = true @@ -127,10 +133,22 @@ position = Vector2(80, 175) [node name="CharacterBody2D" type="CharacterBody2D" parent="NPCs" unique_id=1487693855] position = Vector2(93, 85) +[node name="CollisionShape2D" type="CollisionShape2D" parent="NPCs/CharacterBody2D" unique_id=542589948] +position = Vector2(-0.5, -2) +shape = SubResource("RectangleShape2D_ec540") + [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="NPCs/CharacterBody2D" unique_id=1921427945] sprite_frames = SubResource("SpriteFrames_qunaf") autoplay = "default" +[node name="Dialogue Trigger" parent="NPCs/CharacterBody2D" unique_id=661667742 instance=ExtResource("5_msu6a")] +dialogue_name = "MSG_BLACKSMITH" + +[node name="CollisionShape2D" type="CollisionShape2D" parent="NPCs/CharacterBody2D/Dialogue Trigger" unique_id=2044300734] +position = Vector2(-0.5, -4) +shape = SubResource("RectangleShape2D_6xfm6") +debug_color = Color(0.7930861, 0.42714188, 7.70092e-07, 0.41960785) + [node name="Camera2D" type="Camera2D" parent="." unique_id=2134984506] position = Vector2(127, 110) zoom = Vector2(3, 3) diff --git a/Scenes/Maps/Forest Dungeon Entrance/path_to_dungeon_01.tscn b/Scenes/Maps/Forest Dungeon Entrance/path_to_dungeon_01.tscn index d83bf73..e1f1cb2 100644 --- a/Scenes/Maps/Forest Dungeon Entrance/path_to_dungeon_01.tscn +++ b/Scenes/Maps/Forest Dungeon Entrance/path_to_dungeon_01.tscn @@ -25,6 +25,7 @@ [ext_resource type="PackedScene" uid="uid://coaf2ndwb6h61" path="res://Scenes/Objects/Decorative/Signs/wooden_sign_02.tscn" id="19_jtncl"] [ext_resource type="PackedScene" uid="uid://cla2d3gii8qda" path="res://Scenes/Objects/Loading Zone/interactive_loading_zone.tscn" id="20_c5vrl"] [ext_resource type="PackedScene" uid="uid://b60nr4wfvijpf" path="res://Scenes/Objects/Dialogue/dialogue_trigger.tscn" id="20_x6da4"] +[ext_resource type="PackedScene" uid="uid://c7rjjlamkqhnw" path="res://Scenes/Debug/under_construction_block.tscn" id="26_4lnhp"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_lwurn"] size = Vector2(768, 494) @@ -336,13 +337,51 @@ destination_marker_name = "Entrance" position = Vector2(278, 474) [node name="Player" parent="." unique_id=1502234578 instance=ExtResource("4_4igim")] -position = Vector2(207, 481) +position = Vector2(656, 488) [node name="Camera2D" type="Camera2D" parent="Player" unique_id=1115720225] position = Vector2(0, 1) zoom = Vector2(3, 3) position_smoothing_enabled = true +[node name="Debug" type="Node2D" parent="." unique_id=1186828407] + +[node name="Under Construction Block" parent="Debug" unique_id=390553492 instance=ExtResource("26_4lnhp")] +position = Vector2(51, 648) + +[node name="Under Construction Block2" parent="Debug" unique_id=1351690442 instance=ExtResource("26_4lnhp")] +position = Vector2(67, 648) + +[node name="Under Construction Block3" parent="Debug" unique_id=1745219253 instance=ExtResource("26_4lnhp")] +position = Vector2(83, 648) + +[node name="Under Construction Block4" parent="Debug" unique_id=1747088705 instance=ExtResource("26_4lnhp")] +position = Vector2(99, 648) + +[node name="Under Construction Block5" parent="Debug" unique_id=647551373 instance=ExtResource("26_4lnhp")] +position = Vector2(99, 648) + +[node name="Under Construction Block6" parent="Debug" unique_id=1848435737 instance=ExtResource("26_4lnhp")] +position = Vector2(115, 648) + +[node name="Under Construction Block7" parent="Debug" unique_id=1030022743 instance=ExtResource("26_4lnhp")] +position = Vector2(131, 648) + +[node name="Under Construction Block8" parent="Debug" unique_id=936966717 instance=ExtResource("26_4lnhp")] +position = Vector2(147, 648) + +[node name="Under Construction Block9" parent="Debug" unique_id=1242991407 instance=ExtResource("26_4lnhp")] +position = Vector2(760, 280) + +[node name="Under Construction Block10" parent="Debug" unique_id=341914637 instance=ExtResource("26_4lnhp")] +position = Vector2(760, 296) + +[node name="Under Construction Block11" parent="Debug" unique_id=92502654 instance=ExtResource("26_4lnhp")] +position = Vector2(760, 312) + +[node name="Under Construction Block12" parent="Debug" unique_id=1005752992 instance=ExtResource("26_4lnhp")] +position = Vector2(760, 328) + [connection signal="SitOnBenchTriggered" from="Connectors/Bench Interaction Connector" to="Player" method="OnSitOnFurnitureTriggered"] [connection signal="TargetHit" from="Objects/ArrowTarget" to="Objects/Spike Gate" method="OpenGate"] [connection signal="TargetHit" from="Objects/ArrowTarget" to="Objects/Spike Gate2" method="OpenGate"] diff --git a/Scripts/Characters/Player/States/play_animation_state.gd b/Scripts/Characters/Player/States/play_animation_state.gd new file mode 100644 index 0000000..cd474dd --- /dev/null +++ b/Scripts/Characters/Player/States/play_animation_state.gd @@ -0,0 +1,30 @@ +extends BaseState +class_name PlayerPlayAnimationState + +signal PlayAnimation(animation_name: String) +signal AnimationFinished(animation_name: String) + +var current_animation_name: String + +# Public Methods +func GetAnimationBaseName() -> String: + return "idle" + + +func GetStateEnum() -> PlayerStateMachine.States: + return PlayerStateMachine.States.PLAY_ANIMATION + + +func Enter(_extra_parameters: Dictionary) -> void: + current_animation_name = _extra_parameters["animation_name"] + print("Playing Player Animation State: [%s]" % current_animation_name) + PlayAnimation.emit(current_animation_name) + + +func Exit() -> void: + current_animation_name = '' + + +func OnAnimationFinished(animation_name: String) -> void: + if animation_name != current_animation_name: return + AnimationFinished.emit(animation_name) diff --git a/Scripts/Characters/Player/States/play_animation_state.gd.uid b/Scripts/Characters/Player/States/play_animation_state.gd.uid new file mode 100644 index 0000000..eada39d --- /dev/null +++ b/Scripts/Characters/Player/States/play_animation_state.gd.uid @@ -0,0 +1 @@ +uid://wfdtd3xlgrvm diff --git a/Scripts/Characters/Player/States/walking_state.gd b/Scripts/Characters/Player/States/walking_state.gd index 88c761b..9b51991 100644 --- a/Scripts/Characters/Player/States/walking_state.gd +++ b/Scripts/Characters/Player/States/walking_state.gd @@ -1,7 +1,8 @@ extends BaseState -@export var walking_speed := 100 +signal StartedWalking +@export var walking_speed := 100 @export var movement_component: MovementComponent @export var direction_component: FacingDirectionComponent @export var body: CharacterBody2D @@ -10,6 +11,10 @@ func GetStateEnum() -> PlayerStateMachine.States: return PlayerStateMachine.States.WALKING +func Enter(_extra_parameters: Dictionary) -> void: + StartedWalking.emit() + + func Update(_delta: float) -> void: if movement_component.movement_vector == Vector2.ZERO: state_machine.QueueStateChange(PlayerStateMachine.States.IDLE) diff --git a/Scripts/Characters/Player/player.gd b/Scripts/Characters/Player/player.gd index c598f5b..8b1effb 100644 --- a/Scripts/Characters/Player/player.gd +++ b/Scripts/Characters/Player/player.gd @@ -15,7 +15,8 @@ signal SitOnFurnitureTriggered(sitting_position: Vector2, sitting_direction: Enu signal CutsceneStarted() signal CutsceneEnded() -@onready var state_machine: PlayerStateMachine = $StateMachine +@export var player_sprite: Node2D +@export var state_machine: PlayerStateMachine # Public Methods func OnSitOnFurnitureTriggered(sitting_position: Vector2, sitting_direction: Enums.Directions): diff --git a/Scripts/Characters/Player/sprite.gd b/Scripts/Characters/Player/sprite.gd index cbb7915..df5e006 100644 --- a/Scripts/Characters/Player/sprite.gd +++ b/Scripts/Characters/Player/sprite.gd @@ -2,6 +2,7 @@ extends Node2D signal DrawingBowAnimationFinished signal FiringArrowAnimationFinished +signal AnimationFinished(animation_name: String) @export var state_machine: PlayerStateMachine @export var direction_component: FacingDirectionComponent @@ -41,6 +42,14 @@ func OnAnimationFinished() -> void: DrawingBowAnimationFinished.emit() elif current_animation.begins_with("firing-arrow-"): FiringArrowAnimationFinished.emit() + AnimationFinished.emit(current_animation) + + +func PlaySpecifiedAnimation(animation_name: String) -> void: + current_animation = animation_name + for part in all_parts: + part.animation = animation_name + part.play() # Called when the node enters the scene tree for the first time. diff --git a/Scripts/Characters/Player/state_machine.gd b/Scripts/Characters/Player/state_machine.gd index 446a1ba..6612bf7 100644 --- a/Scripts/Characters/Player/state_machine.gd +++ b/Scripts/Characters/Player/state_machine.gd @@ -1,9 +1,11 @@ extends Node class_name PlayerStateMachine +signal StateChanged + enum States { UNSET, IDLE, WALKING, USING_ITEM_A, DRAWING_BOW, FIRING_ARROW, - SITTING, CUTSCENE + SITTING, CUTSCENE, PLAY_ANIMATION } @export var states_container: Node @@ -36,7 +38,6 @@ func _ready() -> void: current_state.Enter({}) -# Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: if current_state: current_state.Update(delta) @@ -53,3 +54,5 @@ func _swap_state() -> void: current_state.Enter(queued_parameters) queued_state = PlayerStateMachine.States.UNSET queued_parameters = {} + + StateChanged.emit() diff --git a/Scripts/Maps/Connectors/chest_interaction_connector.gd b/Scripts/Maps/Connectors/chest_interaction_connector.gd index ff22c84..afdbea9 100644 --- a/Scripts/Maps/Connectors/chest_interaction_connector.gd +++ b/Scripts/Maps/Connectors/chest_interaction_connector.gd @@ -41,13 +41,40 @@ func OnPlayerInteractionActionTriggered() -> void: # Private Methods func _ready() -> void: - var all_players := get_tree().get_nodes_in_group("Player Group") - if all_players == null or all_players.is_empty(): + var player := GroupUtils.GetPlayer() + if player == null: return - for player_node in all_players: - var player := player_node as PlayerCharacter - - player.InteractScannerAreaEntered.connect(OnPlayerInteractScannerAreaEntered) - player.InteractScannerAreaExited.connect(OnPlayerInteractScannerAreaExited) - player.InteractionActionTriggered.connect(OnPlayerInteractionActionTriggered) + player.InteractScannerAreaEntered.connect(OnPlayerInteractScannerAreaEntered) + player.InteractScannerAreaExited.connect(OnPlayerInteractScannerAreaExited) + player.InteractionActionTriggered.connect(OnPlayerInteractionActionTriggered) + + var chests := GroupUtils.GetAllTreasureChests() + for chest in chests: + chest.OpeningAnimationStarted.connect(_on_chest_opening_animation_started) + + +func _on_chest_opening_animation_started() -> void: + var player := GroupUtils.GetPlayer() + var children := player.get_children() + + player.OnCutsceneStarted() + + var camera_idx := children.find_custom(func(x): return x is Camera2D) + if camera_idx == -1: return + + # Zoom In + var camera := children[camera_idx] as Camera2D + var current_zoom := camera.zoom + await get_tree().create_tween().tween_property(camera, "zoom", current_zoom + Vector2(2, 2), 0.5).finished + + # Player the player's chest opening animation + player.state_machine.QueueStateChange(PlayerStateMachine.States.PLAY_ANIMATION, { "animation_name": "opening-chest-down" }) + await player.state_machine.StateChanged + var play_animation_state := player.state_machine.current_state as PlayerPlayAnimationState + await play_animation_state.AnimationFinished + player.state_machine.QueueStateChange(PlayerStateMachine.States.IDLE) + + # Zoom back out + await get_tree().create_tween().tween_property(camera, "zoom", current_zoom, 0.5).finished + diff --git a/Scripts/Objects/Chests/Bases/chest_base.gd b/Scripts/Objects/Chests/Bases/chest_base.gd index 5f79b26..215736d 100644 --- a/Scripts/Objects/Chests/Bases/chest_base.gd +++ b/Scripts/Objects/Chests/Bases/chest_base.gd @@ -1,6 +1,8 @@ extends StaticBody2D class_name BaseChest +signal OpeningAnimationStarted + @export var is_open := false # Public Methods diff --git a/Scripts/Objects/Chests/item_chest_01.gd b/Scripts/Objects/Chests/item_chest_01.gd index ac73cc8..48a8e6d 100644 --- a/Scripts/Objects/Chests/item_chest_01.gd +++ b/Scripts/Objects/Chests/item_chest_01.gd @@ -14,6 +14,8 @@ func Open() -> void: return super.Open() + + OpeningAnimationStarted.emit() chest_01_sprite.play("opening") var item_name: String = Enums.Items.keys()[item_id] diff --git a/Scripts/UI/dialogue_box.gd b/Scripts/UI/dialogue_box.gd index 8aac70b..25f1ae5 100644 --- a/Scripts/UI/dialogue_box.gd +++ b/Scripts/UI/dialogue_box.gd @@ -6,17 +6,41 @@ signal DialogueEnded @onready var label: Label = $ColorRect/MarginContainer/Label +var _dialogue_arr: PackedStringArray +var _dialogue_idx := 0 +var _dialogue_count := 0 + # Public Methods func OnDialogueTriggered(dialogue_name: String) -> void: - label.text = tr(dialogue_name) + var text_arr := tr(dialogue_name).split("") + _init_dialogue_box(text_arr) visible = true DialogueStarted.emit() +# Private Methods +func _init_dialogue_box(text_arr: PackedStringArray) -> void: + _dialogue_arr = text_arr + _dialogue_idx = 0 + _dialogue_count = len(text_arr) + + label.text = _dialogue_arr[_dialogue_idx] + + +func _proceed_dialogue() -> bool: # Returns true if no more dialogue + _dialogue_idx += 1 + if _dialogue_idx == _dialogue_count: + return true + label.text = _dialogue_arr[_dialogue_idx] + return false + + func _process(_delta: float) -> void: if !visible: return if Input.is_action_just_pressed("player_interact") and !InputManager.ShouldIgnoreAction("player_interact"): - visible = false - DialogueEnded.emit() + var finished := _proceed_dialogue() + if finished: + visible = false + DialogueEnded.emit() diff --git a/project.godot b/project.godot index 278441e..906935b 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="Archipelago Game" -config/version="beta-1.0" +config/version="beta-1.1" run/main_scene="uid://dqgxg3i307lvr" config/features=PackedStringArray("4.6", "Forward Plus") config/icon="res://icon.svg"