diff --git a/assets/sfx/coin2.ogg b/assets/sfx/coin2.ogg new file mode 100644 index 0000000000000000000000000000000000000000..dbb0ed82545a0a81e3a59d208ec6dbb705340918 Binary files /dev/null and b/assets/sfx/coin2.ogg differ diff --git a/assets/sfx/coin2.ogg.import b/assets/sfx/coin2.ogg.import new file mode 100644 index 0000000000000000000000000000000000000000..902cdccbeab4155f947240544bdeed77dcf2b56e --- /dev/null +++ b/assets/sfx/coin2.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://8liw1h2g4xsm" +path="res://.godot/imported/coin2.ogg-7efe830ec469a13b729be417186a8273.oggvorbisstr" + +[deps] + +source_file="res://assets/sfx/coin2.ogg" +dest_files=["res://.godot/imported/coin2.ogg-7efe830ec469a13b729be417186a8273.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/assets/sfx/doorClose_4.ogg b/assets/sfx/doorClose_4.ogg new file mode 100644 index 0000000000000000000000000000000000000000..98d8a2d55b28d6062d68dc10ab34561c54a465ac Binary files /dev/null and b/assets/sfx/doorClose_4.ogg differ diff --git a/assets/sfx/doorClose_4.ogg.import b/assets/sfx/doorClose_4.ogg.import new file mode 100644 index 0000000000000000000000000000000000000000..98e36a8e82c4cd57173a88bffd1b0c80fdf9b02f --- /dev/null +++ b/assets/sfx/doorClose_4.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://d0fqunqsgssgd" +path="res://.godot/imported/doorClose_4.ogg-8542d4f4a4bff59c07dd857eac29ac72.oggvorbisstr" + +[deps] + +source_file="res://assets/sfx/doorClose_4.ogg" +dest_files=["res://.godot/imported/doorClose_4.ogg-8542d4f4a4bff59c07dd857eac29ac72.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/assets/sfx/doorOpen_2.ogg b/assets/sfx/doorOpen_2.ogg new file mode 100644 index 0000000000000000000000000000000000000000..6fd531d5d52d9720a090475f434bc130d15d3fc2 Binary files /dev/null and b/assets/sfx/doorOpen_2.ogg differ diff --git a/assets/sfx/doorOpen_2.ogg.import b/assets/sfx/doorOpen_2.ogg.import new file mode 100644 index 0000000000000000000000000000000000000000..d6783fceb86809a8557484ac53a512553529c8cf --- /dev/null +++ b/assets/sfx/doorOpen_2.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://cwpbiytveaon0" +path="res://.godot/imported/doorOpen_2.ogg-803f42acaa6d25118f5f3611413ea6c3.oggvorbisstr" + +[deps] + +source_file="res://assets/sfx/doorOpen_2.ogg" +dest_files=["res://.godot/imported/doorOpen_2.ogg-803f42acaa6d25118f5f3611413ea6c3.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/src/common/music/music_player.tscn b/src/common/music/music_player.tscn index ed1259131a1a495207f29b286204d8ef5f9ebb86..abbbb367521e87261641f56a6f7d72070e834ffb 100644 --- a/src/common/music/music_player.tscn +++ b/src/common/music/music_player.tscn @@ -2,8 +2,8 @@ [ext_resource type="Script" path="res://src/common/music/music_player.gd" id="1_m166w"] -[sub_resource type="Animation" id="Animation_e1vdt"] -resource_name = "fade_out" +[sub_resource type="Animation" id="Animation_meedk"] +length = 0.001 tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true @@ -11,14 +11,14 @@ tracks/0/path = NodePath("AudioStreamPlayer:volume_db") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { -"times": PackedFloat32Array(0, 1), -"transitions": PackedFloat32Array(1, 1), +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), "update": 0, -"values": [0.0, -50.0] +"values": [0.0] } -[sub_resource type="Animation" id="Animation_meedk"] -length = 0.001 +[sub_resource type="Animation" id="Animation_ln66x"] +resource_name = "fade_in" tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true @@ -26,14 +26,14 @@ tracks/0/path = NodePath("AudioStreamPlayer:volume_db") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/keys = { -"times": PackedFloat32Array(0), -"transitions": PackedFloat32Array(1), +"times": PackedFloat32Array(0, 1), +"transitions": PackedFloat32Array(1, 1), "update": 0, -"values": [0.0] +"values": [-50.0, 0.0] } -[sub_resource type="Animation" id="Animation_ln66x"] -resource_name = "fade_in" +[sub_resource type="Animation" id="Animation_e1vdt"] +resource_name = "fade_out" tracks/0/type = "value" tracks/0/imported = false tracks/0/enabled = true @@ -44,7 +44,7 @@ tracks/0/keys = { "times": PackedFloat32Array(0, 1), "transitions": PackedFloat32Array(1, 1), "update": 0, -"values": [-50.0, 0.0] +"values": [0.0, -50.0] } [sub_resource type="AnimationLibrary" id="AnimationLibrary_isbl1"] diff --git a/src/field/cutscenes/templates/keys/key.gd b/src/field/cutscenes/templates/pickups/pickup.gd similarity index 100% rename from src/field/cutscenes/templates/keys/key.gd rename to src/field/cutscenes/templates/pickups/pickup.gd diff --git a/src/field/cutscenes/templates/keys/key.tscn b/src/field/cutscenes/templates/pickups/pickup.tscn similarity index 84% rename from src/field/cutscenes/templates/keys/key.tscn rename to src/field/cutscenes/templates/pickups/pickup.tscn index d643d81fdd576afd100fbbeee6fe6494a19c3b7d..25b2c4a318a5b7d23f11cfa7d32f4ee855baccb5 100644 --- a/src/field/cutscenes/templates/keys/key.tscn +++ b/src/field/cutscenes/templates/pickups/pickup.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=8 format=3 uid="uid://ceefih4ls7dcn"] +[gd_scene load_steps=9 format=3 uid="uid://ceefih4ls7dcn"] -[ext_resource type="Script" path="res://src/field/cutscenes/templates/keys/key.gd" id="1_3ccf8"] +[ext_resource type="Script" path="res://src/field/cutscenes/templates/pickups/pickup.gd" id="1_3ccf8"] [ext_resource type="PackedScene" uid="uid://dpopnsfpfdasl" path="res://src/field/cutscenes/Trigger.tscn" id="1_wydyv"] [ext_resource type="Texture2D" uid="uid://d2qfi5sncf72b" path="res://assets/terrain/town_tilemap.png" id="2_anxc4"] +[ext_resource type="AudioStream" uid="uid://8liw1h2g4xsm" path="res://assets/sfx/coin2.ogg" id="4_cbxjc"] [sub_resource type="Animation" id="Animation_u4cto"] length = 0.001 @@ -88,6 +89,21 @@ tracks/2/keys = { "update": 0, "values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)] } +tracks/3/type = "audio" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("AudioStreamPlayer") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"clips": [{ +"end_offset": 0.0, +"start_offset": 0.0, +"stream": ExtResource("4_cbxjc") +}], +"times": PackedFloat32Array(0) +} +tracks/3/use_blend = true [sub_resource type="AnimationLibrary" id="AnimationLibrary_dm7dx"] _data = { @@ -96,7 +112,7 @@ _data = { "obtain": SubResource("Animation_yvqqw") } -[node name="Key" type="Node2D"] +[node name="Pickup" type="Node2D"] script = ExtResource("1_3ccf8") metadata/_edit_group_ = true diff --git a/src/field/cutscenes/templates/treasure_chests/chest.gd b/src/field/cutscenes/templates/treasure_chests/chest.gd new file mode 100644 index 0000000000000000000000000000000000000000..28345415df19a77afd51ec1dbccbcc01a191e210 --- /dev/null +++ b/src/field/cutscenes/templates/treasure_chests/chest.gd @@ -0,0 +1,34 @@ +extends Interaction + +@export var item_type: Inventory.ItemTypes +@export var amount: = 1 + +var _is_open: = false +var _item_received: = false: + set(value): + _item_received = value + if _item_received: + _popup.queue_free() + +@onready var _anim: = $AnimationPlayer as AnimationPlayer +@onready var _popup: = $InteractionPopup + + +# Open or close the chest, depending on whether it is closed or open. +# If this is the first time opening it, apply the items inside to the player's inventory. +func _execute() -> void: + if _is_open: + _anim.play("close") + await _anim.animation_finished + _is_open = false + + else: + _anim.play("open") + await _anim.animation_finished + + if not _item_received: + var inventory: = Inventory.restore() + inventory.add(item_type, amount) + _item_received = true + + _is_open = true diff --git a/src/field/cutscenes/templates/treasure_chests/chest.tscn b/src/field/cutscenes/templates/treasure_chests/chest.tscn new file mode 100644 index 0000000000000000000000000000000000000000..3fb43151becb3ebcf9f4e78f5678bd831bfd081b --- /dev/null +++ b/src/field/cutscenes/templates/treasure_chests/chest.tscn @@ -0,0 +1,122 @@ +[gd_scene load_steps=12 format=3 uid="uid://c8jtuge5yaqxa"] + +[ext_resource type="PackedScene" uid="uid://oot0x5n44b2r" path="res://src/field/cutscenes/Interaction.tscn" id="1_pr2rt"] +[ext_resource type="Script" path="res://src/field/cutscenes/templates/treasure_chests/chest.gd" id="2_55lx5"] +[ext_resource type="Texture2D" uid="uid://dm4h0uo6gjp22" path="res://assets/terrain/dungeon_tilemap.png" id="3_gr80q"] +[ext_resource type="AudioStream" uid="uid://cwpbiytveaon0" path="res://assets/sfx/doorOpen_2.ogg" id="4_6verl"] +[ext_resource type="AudioStream" uid="uid://d0fqunqsgssgd" path="res://assets/sfx/doorClose_4.ogg" id="5_fwhp7"] +[ext_resource type="PackedScene" uid="uid://cubp81mykng3h" path="res://src/field/cutscenes/popups/InteractionPopup.tscn" id="6_hmx7o"] + +[sub_resource type="Animation" id="Animation_a1cbh"] +resource_name = "open" +length = 0.5 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:region_rect") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 1, +"values": [Rect2(85, 119, 16, 16), Rect2(102, 119, 16, 16), Rect2(119, 119, 16, 16)] +} +tracks/1/type = "audio" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("OpenAudio") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"clips": [{ +"end_offset": 0.0, +"start_offset": 0.0, +"stream": ExtResource("4_6verl") +}], +"times": PackedFloat32Array(0) +} +tracks/1/use_blend = true + +[sub_resource type="Animation" id="Animation_upvuf"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:region_rect") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Rect2(85, 119, 16, 16)] +} + +[sub_resource type="Animation" id="Animation_7v12p"] +resource_name = "close" +length = 0.5 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Sprite2D:region_rect") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 1, +"values": [Rect2(119, 119, 16, 16), Rect2(102, 119, 16, 16), Rect2(85, 119, 16, 16)] +} +tracks/1/type = "audio" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("OpenAudio") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"clips": [{ +"end_offset": 0.0, +"start_offset": 0.0, +"stream": ExtResource("5_fwhp7") +}], +"times": PackedFloat32Array(0) +} +tracks/1/use_blend = true + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_novt7"] +_data = { +"RESET": SubResource("Animation_upvuf"), +"close": SubResource("Animation_7v12p"), +"open": SubResource("Animation_a1cbh") +} + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_11osp"] +size = Vector2(15, 15) + +[node name="Chest" instance=ExtResource("1_pr2rt")] +script = ExtResource("2_55lx5") +item_type = 0 +amount = 1 + +[node name="Sprite2D" type="Sprite2D" parent="." index="1"] +texture = ExtResource("3_gr80q") +region_enabled = true +region_rect = Rect2(85, 119, 16, 16) + +[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="2"] +libraries = { +"": SubResource("AnimationLibrary_novt7") +} + +[node name="OpenAudio" type="AudioStreamPlayer" parent="." index="3"] + +[node name="MovementBlock" type="Area2D" parent="." index="4"] +collision_mask = 0 +monitoring = false + +[node name="CollisionShape2D" type="CollisionShape2D" parent="MovementBlock" index="0"] +shape = SubResource("RectangleShape2D_11osp") + +[node name="InteractionPopup" parent="." index="5" instance=ExtResource("6_hmx7o")] +emote = 1 diff --git a/src/main.tscn b/src/main.tscn index 2b2cc2604693256280569fadd5611ea20eaf4d4d..dab974bc709368cdd038c57e75e02e1d0232c4c2 100644 --- a/src/main.tscn +++ b/src/main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=55 format=3 uid="uid://p01fb6nvi144"] +[gd_scene load_steps=56 format=3 uid="uid://p01fb6nvi144"] [ext_resource type="Script" path="res://src/field/field.gd" id="2_bkxev"] [ext_resource type="Script" path="res://src/field/field_cursor.gd" id="5_3guor"] @@ -36,9 +36,10 @@ [ext_resource type="Resource" path="res://data/maps/town/fan_of_four.dtl" id="25_dmuyg"] [ext_resource type="PackedScene" uid="uid://c14b8ageu2otv" path="res://src/field/cutscenes/templates/doors/door.tscn" id="26_kf5ye"] [ext_resource type="Script" path="res://src/field/gamepieces/controllers/gamepiece_controller.gd" id="26_p8jrd"] -[ext_resource type="PackedScene" uid="uid://ceefih4ls7dcn" path="res://src/field/cutscenes/templates/keys/key.tscn" id="29_gxq7u"] +[ext_resource type="PackedScene" uid="uid://ceefih4ls7dcn" path="res://src/field/cutscenes/templates/pickups/pickup.tscn" id="29_gxq7u"] [ext_resource type="Script" path="res://data/maps/town/strange_tree_interaction.gd" id="31_y2el4"] [ext_resource type="Resource" path="res://data/maps/town/strange_tree.dtl" id="32_m0jee"] +[ext_resource type="PackedScene" uid="uid://c8jtuge5yaqxa" path="res://src/field/cutscenes/templates/treasure_chests/chest.tscn" id="33_7djdg"] [ext_resource type="Texture2D" uid="uid://d2qfi5sncf72b" path="res://assets/terrain/town_tilemap.png" id="33_ofo2l"] [ext_resource type="PackedScene" uid="uid://cubp81mykng3h" path="res://src/field/cutscenes/popups/InteractionPopup.tscn" id="34_qs25x"] [ext_resource type="Script" path="res://src/field/ui/inventory/ui_inventory.gd" id="34_tk01t"] @@ -329,6 +330,11 @@ metadata/_edit_group_ = true [node name="Key" parent="Terrain/Gamepieces" instance=ExtResource("29_gxq7u")] position = Vector2(40, 24) +[node name="Chest" parent="Terrain/Gamepieces" instance=ExtResource("33_7djdg")] +position = Vector2(216, 168) +item_type = 3 +amount = 4 + [node name="StrangeTreeInteraction" parent="Terrain" instance=ExtResource("19_sa6jd")] position = Vector2(56, 72) script = ExtResource("31_y2el4")