diff --git a/Bossa Monstra.wav b/Bossa Monstra.wav new file mode 100644 index 0000000..cd3243d Binary files /dev/null and b/Bossa Monstra.wav differ diff --git a/Bossa Monstra.wav.import b/Bossa Monstra.wav.import new file mode 100644 index 0000000..710e518 --- /dev/null +++ b/Bossa Monstra.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://br26r6ck51wa1" +path="res://.godot/imported/Bossa Monstra.wav-80ccc0aa331392d0ad6a586bd68ad167.sample" + +[deps] + +source_file="res://Bossa Monstra.wav" +dest_files=["res://.godot/imported/Bossa Monstra.wav-80ccc0aa331392d0ad6a586bd68ad167.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=2 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/Main.tscn b/Main.tscn index 43bef61..bf86ccf 100644 --- a/Main.tscn +++ b/Main.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=5 format=3 uid="uid://bs6ojoud4mvb8"] +[gd_scene load_steps=6 format=3 uid="uid://bs6ojoud4mvb8"] [ext_resource type="Script" path="res://main.gd" id="1_x66oe"] [ext_resource type="PackedScene" uid="uid://ccdhbljb3e0oh" path="res://src/ui/MainUI.tscn" id="2_anen6"] [ext_resource type="PackedScene" uid="uid://cr2nvts234wlw" path="res://src/manager/TimeManager.tscn" id="2_rrhko"] [ext_resource type="Texture2D" uid="uid://c37jv23kd15ay" path="res://parts/zones/images/home.png" id="3_kjcur"] +[ext_resource type="AudioStream" uid="uid://br26r6ck51wa1" path="res://Bossa Monstra.wav" id="5_qgck0"] [node name="Main" type="Node2D"] script = ExtResource("1_x66oe") @@ -21,4 +22,9 @@ texture = ExtResource("3_kjcur") one_shot = true autostart = true +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource("5_qgck0") +volume_db = -18.0 +autoplay = true + [connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] diff --git a/components/Cursor/Cursor.tscn b/components/Cursor/Cursor.tscn index f3fd45e..99e6fa5 100644 --- a/components/Cursor/Cursor.tscn +++ b/components/Cursor/Cursor.tscn @@ -1,7 +1,10 @@ -[gd_scene load_steps=4 format=3 uid="uid://qecwga1b4yqn"] +[gd_scene load_steps=7 format=3 uid="uid://qecwga1b4yqn"] [ext_resource type="Script" path="res://components/Cursor/cursor.gd" id="1_nmkwm"] [ext_resource type="Texture2D" uid="uid://kd8031vdmxb8" path="res://components/Cursor/normal-1.png" id="2_ucp64"] +[ext_resource type="AudioStream" uid="uid://b1625im32ajr2" path="res://sfx/error can't put down creature.wav" id="3_68rl2"] +[ext_resource type="AudioStream" uid="uid://da4gfw2de7at" path="res://sfx/put down.wav" id="4_vcjyr"] +[ext_resource type="AudioStream" uid="uid://bqn8ygvwt58sg" path="res://sfx/pick up.wav" id="5_mmqlh"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_4cq27"] size = Vector2(8, 8) @@ -21,5 +24,17 @@ visible = false position = Vector2(2, 4) texture = ExtResource("2_ucp64") +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource("3_68rl2") +volume_db = -10.0 + +[node name="AudioStreamPlayer2" type="AudioStreamPlayer" parent="."] +stream = ExtResource("4_vcjyr") +volume_db = -10.0 + +[node name="AudioStreamPlayer3" type="AudioStreamPlayer" parent="."] +stream = ExtResource("5_mmqlh") +volume_db = -10.0 + [connection signal="area_entered" from="MouseControl" to="." method="_on_mouse_control_area_entered"] [connection signal="area_exited" from="MouseControl" to="." method="_on_mouse_control_area_exited"] diff --git a/components/Cursor/cursor.gd b/components/Cursor/cursor.gd index 115298a..41533f4 100644 --- a/components/Cursor/cursor.gd +++ b/components/Cursor/cursor.gd @@ -3,6 +3,9 @@ extends Base @onready var mouse_control = $"MouseControl" @onready var sprite_2d: Sprite2D = $MouseControl/Sprite2D +@onready var audio_stream_player: AudioStreamPlayer = $AudioStreamPlayer +@onready var audio_stream_player_2: AudioStreamPlayer = $AudioStreamPlayer2 +@onready var audio_stream_player_3: AudioStreamPlayer = $AudioStreamPlayer3 const CURSOR_UI = preload("res://components/Cursor/hover-1.png") const CURSOR_HOLD = preload("res://components/Cursor/grab-1.png") @@ -35,15 +38,18 @@ func _on_hovered(_data): func _on_grab_creature(data): - print("GRAB") grabbed_creature = CREATURE.instantiate() grabbed_creature.key = data.creature + grabbed_creature.held = true mouse_control.add_child(grabbed_creature) grabbed_creature.position = Vector2(0, 0) holding = true original_window = data.old_window original_position = data.old_position + + if get_window().get_window_id() == 0: + audio_stream_player_3.play() func let_go(): if holding and grabbed_creature: @@ -55,6 +61,11 @@ func let_go(): if get_window().get_window_id() == 0: Persister.persist_data("grabbing", false) + + if Persister.get_value("hovered"): + audio_stream_player_2.play() + else: + audio_stream_player.play() if signal_object and signal_object.mouse_in_window: var new_creature = CREATURE.instantiate() @@ -69,7 +80,6 @@ func let_go(): holding = false func _on_release(): - print("RElEASED %d" % [get_window().get_window_id()]) let_go() Triggerer.trigger("released") diff --git a/main.gd b/main.gd index d58d07b..2923685 100644 --- a/main.gd +++ b/main.gd @@ -11,7 +11,11 @@ const CREATURE_WINDOW = preload("res://src/CreatureWindow.tscn") var build_object +@onready var upgrade_pool = Data.data.upgrades.keys() +@onready var zone_pool = Data.data.zones.keys() + func _ready() -> void: + Persister.persist_data("creature_resource_spawn_rate", 20) Triggerer.listen("spawn_window", _on_spawn_window) Triggerer.listen("upgrade_menu", _on_build_menu) Triggerer.listen("quit", _on_quit) diff --git a/parts/upgrades/desert-card.aseprite b/parts/upgrades/desert-card.aseprite new file mode 100644 index 0000000..781379c Binary files /dev/null and b/parts/upgrades/desert-card.aseprite differ diff --git a/parts/upgrades/desert-card.png b/parts/upgrades/desert-card.png new file mode 100644 index 0000000..6da0bac Binary files /dev/null and b/parts/upgrades/desert-card.png differ diff --git a/parts/upgrades/desert-card.png.import b/parts/upgrades/desert-card.png.import new file mode 100644 index 0000000..70764ed --- /dev/null +++ b/parts/upgrades/desert-card.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bl05hcd2ar2ll" +path="res://.godot/imported/desert-card.png-e335f9eddfa9f3531de5f481124a9c76.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://parts/upgrades/desert-card.png" +dest_files=["res://.godot/imported/desert-card.png-e335f9eddfa9f3531de5f481124a9c76.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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/parts/upgrades/farm-card.aseprite b/parts/upgrades/farm-card.aseprite new file mode 100644 index 0000000..f1f9737 Binary files /dev/null and b/parts/upgrades/farm-card.aseprite differ diff --git a/parts/upgrades/farm-card.png b/parts/upgrades/farm-card.png new file mode 100644 index 0000000..9396ab9 Binary files /dev/null and b/parts/upgrades/farm-card.png differ diff --git a/parts/upgrades/farm-card.png.import b/parts/upgrades/farm-card.png.import new file mode 100644 index 0000000..e6916c0 --- /dev/null +++ b/parts/upgrades/farm-card.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bngkfdcgy2otl" +path="res://.godot/imported/farm-card.png-ecd5b35304ba445d31b38267506de42a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://parts/upgrades/farm-card.png" +dest_files=["res://.godot/imported/farm-card.png-ecd5b35304ba445d31b38267506de42a.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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/parts/upgrades/forest-card.aseprite b/parts/upgrades/forest-card.aseprite new file mode 100644 index 0000000..f1f9737 Binary files /dev/null and b/parts/upgrades/forest-card.aseprite differ diff --git a/parts/upgrades/forest-card.png b/parts/upgrades/forest-card.png new file mode 100644 index 0000000..9396ab9 Binary files /dev/null and b/parts/upgrades/forest-card.png differ diff --git a/parts/upgrades/forest-card.png.import b/parts/upgrades/forest-card.png.import new file mode 100644 index 0000000..823f728 --- /dev/null +++ b/parts/upgrades/forest-card.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://yu8t3dse0fna" +path="res://.godot/imported/forest-card.png-3c330302bd800bf858d4887b2fde7b5a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://parts/upgrades/forest-card.png" +dest_files=["res://.godot/imported/forest-card.png-3c330302bd800bf858d4887b2fde7b5a.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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/parts/upgrades/generic.aseprite b/parts/upgrades/generic.aseprite new file mode 100644 index 0000000..fa7c1bd Binary files /dev/null and b/parts/upgrades/generic.aseprite differ diff --git a/parts/upgrades/generic.png b/parts/upgrades/generic.png new file mode 100644 index 0000000..6e224bc Binary files /dev/null and b/parts/upgrades/generic.png differ diff --git a/parts/upgrades/generic.png.import b/parts/upgrades/generic.png.import new file mode 100644 index 0000000..5777ca6 --- /dev/null +++ b/parts/upgrades/generic.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://3wxvvlillymm" +path="res://.godot/imported/generic.png-6d708915b524f5c1c5b0b9ff07bd2832.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://parts/upgrades/generic.png" +dest_files=["res://.godot/imported/generic.png-6d708915b524f5c1c5b0b9ff07bd2832.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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/parts/upgrades/lake-card.aseprite b/parts/upgrades/lake-card.aseprite new file mode 100644 index 0000000..a714f9b Binary files /dev/null and b/parts/upgrades/lake-card.aseprite differ diff --git a/parts/upgrades/lake-card.png b/parts/upgrades/lake-card.png new file mode 100644 index 0000000..ea9d8fb Binary files /dev/null and b/parts/upgrades/lake-card.png differ diff --git a/parts/upgrades/lake-card.png.import b/parts/upgrades/lake-card.png.import new file mode 100644 index 0000000..390af48 --- /dev/null +++ b/parts/upgrades/lake-card.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dl3vu6127bcac" +path="res://.godot/imported/lake-card.png-1ac024f66ddfca36a54f522ade24ff20.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://parts/upgrades/lake-card.png" +dest_files=["res://.godot/imported/lake-card.png-1ac024f66ddfca36a54f522ade24ff20.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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/parts/upgrades/more-creature-resources.txt b/parts/upgrades/more-creature-resources.txt index 829b4b6..1dbc544 100644 --- a/parts/upgrades/more-creature-resources.txt +++ b/parts/upgrades/more-creature-resources.txt @@ -1,6 +1,6 @@ -name: Creature Resources -description: More chance for a creature to drop a resource every day -key: creature_resource_spawn_rate +name: Coins Galore +description: 10% higher chance for a creature to drop coins every hour +property: creature_resource_spawn_rate type: percent amount: 10 cost: 10 diff --git a/parts/upgrades/more-creatures.txt b/parts/upgrades/more-creatures.txt index 7e6728b..d0f0ed4 100644 --- a/parts/upgrades/more-creatures.txt +++ b/parts/upgrades/more-creatures.txt @@ -1,5 +1,5 @@ -name: Creature Bait -description: More creatures will wander onto your property every day -key: creature_amount +name: Creature Bait +description: 2 More creatures will wander onto your property every day +property: creature_amount amount: 2 cost: 15 diff --git a/parts/upgrades/more-customers.txt b/parts/upgrades/more-customers.txt deleted file mode 100644 index 3a4d8f3..0000000 --- a/parts/upgrades/more-customers.txt +++ /dev/null @@ -1,5 +0,0 @@ -name: Advertising -description: More customers will visit your shop every day -key: customer_amount -amount: 4 -cost: 12 diff --git a/parts/upgrades/more-resources.txt b/parts/upgrades/more-resources.txt deleted file mode 100644 index cade028..0000000 --- a/parts/upgrades/more-resources.txt +++ /dev/null @@ -1,6 +0,0 @@ -name: More Resources -description: More chance for a resource to spawn in a zone every day -key: resource_spawn_rate -type: percent -amount: 10 -cost: 10 diff --git a/parts/zones/desert.txt b/parts/zones/desert.txt index affb109..6a1b9f0 100644 --- a/parts/zones/desert.txt +++ b/parts/zones/desert.txt @@ -2,4 +2,4 @@ name: Desert size[] 6 6 -description: Test +description: A zone for creatures to live in diff --git a/parts/zones/farm.txt b/parts/zones/farm.txt index 056b7d4..5a5a23a 100644 --- a/parts/zones/farm.txt +++ b/parts/zones/farm.txt @@ -2,4 +2,4 @@ name: Farm size[] 6 5 -description: Test +description: A zone for creatures to live in diff --git a/parts/zones/forest.txt b/parts/zones/forest.txt index f43a003..281a5e3 100644 --- a/parts/zones/forest.txt +++ b/parts/zones/forest.txt @@ -2,4 +2,4 @@ name: Forest size[] 5 6 -description: Test +description: A zone for creatures to live in diff --git a/parts/zones/images/desert.png b/parts/zones/images/desert.png index 68592e8..488868e 100644 Binary files a/parts/zones/images/desert.png and b/parts/zones/images/desert.png differ diff --git a/parts/zones/images/lake.png b/parts/zones/images/lake.png index 8107ae7..73ce092 100644 Binary files a/parts/zones/images/lake.png and b/parts/zones/images/lake.png differ diff --git a/parts/zones/lake.txt b/parts/zones/lake.txt index 1e560c0..c5b99d4 100644 --- a/parts/zones/lake.txt +++ b/parts/zones/lake.txt @@ -2,4 +2,4 @@ name: Lake size[] 7 4 -description: Test +description: A zone for creatures to live in diff --git a/sfx/UI Click 1.wav b/sfx/UI Click 1.wav new file mode 100644 index 0000000..aeb1194 Binary files /dev/null and b/sfx/UI Click 1.wav differ diff --git a/sfx/UI Click 1.wav.import b/sfx/UI Click 1.wav.import new file mode 100644 index 0000000..e45990e --- /dev/null +++ b/sfx/UI Click 1.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://bikfuvnt3i2ui" +path="res://.godot/imported/UI Click 1.wav-b49ab8bf741ef77b72a6e9abac747506.sample" + +[deps] + +source_file="res://sfx/UI Click 1.wav" +dest_files=["res://.godot/imported/UI Click 1.wav-b49ab8bf741ef77b72a6e9abac747506.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/sfx/UI Click 2.wav b/sfx/UI Click 2.wav new file mode 100644 index 0000000..da074a8 Binary files /dev/null and b/sfx/UI Click 2.wav differ diff --git a/sfx/UI Click 2.wav.import b/sfx/UI Click 2.wav.import new file mode 100644 index 0000000..d4d99dc --- /dev/null +++ b/sfx/UI Click 2.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://c06j2q7c0j6br" +path="res://.godot/imported/UI Click 2.wav-8e082e1b42bb7db7f66d38d001e76a84.sample" + +[deps] + +source_file="res://sfx/UI Click 2.wav" +dest_files=["res://.godot/imported/UI Click 2.wav-8e082e1b42bb7db7f66d38d001e76a84.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/sfx/UI Click 3.wav b/sfx/UI Click 3.wav new file mode 100644 index 0000000..4042cf5 Binary files /dev/null and b/sfx/UI Click 3.wav differ diff --git a/sfx/UI Click 3.wav.import b/sfx/UI Click 3.wav.import new file mode 100644 index 0000000..fdbb035 --- /dev/null +++ b/sfx/UI Click 3.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://co8mnuoislrta" +path="res://.godot/imported/UI Click 3.wav-3dac3c87a3a0b6e1da524ef814b33844.sample" + +[deps] + +source_file="res://sfx/UI Click 3.wav" +dest_files=["res://.godot/imported/UI Click 3.wav-3dac3c87a3a0b6e1da524ef814b33844.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/sfx/buying upgrade.wav b/sfx/buying upgrade.wav new file mode 100644 index 0000000..a96f721 Binary files /dev/null and b/sfx/buying upgrade.wav differ diff --git a/sfx/buying upgrade.wav.import b/sfx/buying upgrade.wav.import new file mode 100644 index 0000000..ff64ab8 --- /dev/null +++ b/sfx/buying upgrade.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://fi4ero6v8pon" +path="res://.godot/imported/buying upgrade.wav-b9f7a86d04cbdf851620837e93c4279d.sample" + +[deps] + +source_file="res://sfx/buying upgrade.wav" +dest_files=["res://.godot/imported/buying upgrade.wav-b9f7a86d04cbdf851620837e93c4279d.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/sfx/error can't put down creature.wav b/sfx/error can't put down creature.wav new file mode 100644 index 0000000..1d70c3b Binary files /dev/null and b/sfx/error can't put down creature.wav differ diff --git a/sfx/error can't put down creature.wav.import b/sfx/error can't put down creature.wav.import new file mode 100644 index 0000000..5ed236e --- /dev/null +++ b/sfx/error can't put down creature.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://b1625im32ajr2" +path="res://.godot/imported/error can't put down creature.wav-752b6692e56dcaa8f15222534089b4b0.sample" + +[deps] + +source_file="res://sfx/error can't put down creature.wav" +dest_files=["res://.godot/imported/error can't put down creature.wav-752b6692e56dcaa8f15222534089b4b0.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/sfx/pick up.wav b/sfx/pick up.wav new file mode 100644 index 0000000..43aa75d Binary files /dev/null and b/sfx/pick up.wav differ diff --git a/sfx/pick up.wav.import b/sfx/pick up.wav.import new file mode 100644 index 0000000..65b1015 --- /dev/null +++ b/sfx/pick up.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://bqn8ygvwt58sg" +path="res://.godot/imported/pick up.wav-be58fc83294b6a965fd854e69a6f3152.sample" + +[deps] + +source_file="res://sfx/pick up.wav" +dest_files=["res://.godot/imported/pick up.wav-be58fc83294b6a965fd854e69a6f3152.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/sfx/purchasing new zone.wav b/sfx/purchasing new zone.wav new file mode 100644 index 0000000..9e02e4c Binary files /dev/null and b/sfx/purchasing new zone.wav differ diff --git a/sfx/purchasing new zone.wav.import b/sfx/purchasing new zone.wav.import new file mode 100644 index 0000000..c33d12a --- /dev/null +++ b/sfx/purchasing new zone.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://bhdbbteejyprf" +path="res://.godot/imported/purchasing new zone.wav-af19e12d7a4a4f087cb0e493c95a875b.sample" + +[deps] + +source_file="res://sfx/purchasing new zone.wav" +dest_files=["res://.godot/imported/purchasing new zone.wav-af19e12d7a4a4f087cb0e493c95a875b.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/sfx/put down.wav b/sfx/put down.wav new file mode 100644 index 0000000..a540397 Binary files /dev/null and b/sfx/put down.wav differ diff --git a/sfx/put down.wav.import b/sfx/put down.wav.import new file mode 100644 index 0000000..af7ca80 --- /dev/null +++ b/sfx/put down.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://da4gfw2de7at" +path="res://.godot/imported/put down.wav-c12c6b231c6628af3c5b232cecfaa83d.sample" + +[deps] + +source_file="res://sfx/put down.wav" +dest_files=["res://.godot/imported/put down.wav-c12c6b231c6628af3c5b232cecfaa83d.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/src/BuildWindow.tscn b/src/BuildWindow.tscn index 5c2552a..6eddfa3 100644 --- a/src/BuildWindow.tscn +++ b/src/BuildWindow.tscn @@ -1,10 +1,16 @@ -[gd_scene load_steps=8 format=3 uid="uid://rfc6w6wnl1c2"] +[gd_scene load_steps=14 format=3 uid="uid://rfc6w6wnl1c2"] [ext_resource type="PackedScene" uid="uid://5g4mecc4tb6f" path="res://NoCreMouseSignals.tscn" id="1_33eve"] [ext_resource type="Theme" uid="uid://ck7603ob4gflc" path="res://Fonts/Theme.tres" id="1_ta3q3"] [ext_resource type="Script" path="res://src/build_window.gd" id="1_y8qy0"] [ext_resource type="Script" path="res://small_wave.gd" id="3_0qyx5"] [ext_resource type="PackedScene" uid="uid://dykc1mgg5uopw" path="res://components/Cursor/MouseHandler.tscn" id="4_3uk60"] +[ext_resource type="AudioStream" uid="uid://fi4ero6v8pon" path="res://sfx/buying upgrade.wav" id="6_wvbe0"] +[ext_resource type="Texture2D" uid="uid://3wxvvlillymm" path="res://parts/upgrades/generic.png" id="6_yrfvb"] +[ext_resource type="AudioStream" uid="uid://bhdbbteejyprf" path="res://sfx/purchasing new zone.wav" id="7_wsmt1"] +[ext_resource type="AudioStream" uid="uid://b1625im32ajr2" path="res://sfx/error can't put down creature.wav" id="8_csgwn"] +[ext_resource type="AudioStream" uid="uid://bikfuvnt3i2ui" path="res://sfx/UI Click 1.wav" id="9_fxutd"] +[ext_resource type="Texture2D" uid="uid://5by2gsqdfjju" path="res://wall.png" id="10_up40o"] [sub_resource type="RichTextEffect" id="RichTextEffect_lhkb8"] script = ExtResource("3_0qyx5") @@ -16,9 +22,15 @@ size = Vector2(52, 73) canvas_item_default_texture_filter = 0 position = Vector2i(0, 36) size = Vector2i(900, 500) +unresizable = true always_on_top = true content_scale_factor = 4.0 +[node name="Sprite2D" type="Sprite2D" parent="."] +modulate = Color(0.572988, 0.572988, 0.572988, 1) +position = Vector2(112, 62) +texture = ExtResource("10_up40o") + [node name="MouseSignals" parent="." instance=ExtResource("1_33eve")] [node name="Control" type="Control" parent="."] @@ -32,7 +44,7 @@ theme = ExtResource("1_ta3q3") script = ExtResource("1_y8qy0") [node name="RichTextLabel" type="RichTextLabel" parent="Control"] -modulate = Color(0.559673, 1, 0.532353, 1) +modulate = Color(1, 1, 0.533333, 1) clip_contents = false layout_mode = 1 anchors_preset = 5 @@ -47,7 +59,7 @@ bbcode_enabled = true text = "[smallwave][center]Upgrades" custom_effects = [SubResource("RichTextEffect_lhkb8")] -[node name="RichTextLabel2" type="RichTextLabel" parent="Control"] +[node name="DescriptionText" type="RichTextLabel" parent="Control"] modulate = Color(0.633757, 0.633757, 0.633757, 1) clip_contents = false layout_mode = 1 @@ -62,25 +74,17 @@ grow_horizontal = 2 bbcode_enabled = true text = "[center]Test Description" -[node name="HBoxContainer" type="HBoxContainer" parent="Control"] -layout_mode = 1 -anchors_preset = 8 -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -offset_left = -20.0 -offset_top = -20.0 -offset_right = 20.0 -offset_bottom = 20.0 -grow_horizontal = 2 -grow_vertical = 2 - -[node name="Upgrade" type="ColorRect" parent="Control/HBoxContainer"] +[node name="Upgrade" type="TextureRect" parent="Control"] custom_minimum_size = Vector2(32, 40) layout_mode = 2 +offset_left = 27.5 +offset_top = 42.5 +offset_right = 59.5 +offset_bottom = 82.5 +pivot_offset = Vector2(16, 20) +texture = ExtResource("6_yrfvb") -[node name="Card1Title" type="RichTextLabel" parent="Control/HBoxContainer/Upgrade"] +[node name="Card1Title" type="RichTextLabel" parent="Control/Upgrade"] clip_contents = false layout_mode = 0 offset_left = -22.885 @@ -90,7 +94,7 @@ offset_bottom = 27.685 bbcode_enabled = true text = "[center]Test Title" -[node name="Card1Cost" type="RichTextLabel" parent="Control/HBoxContainer/Upgrade"] +[node name="Card1Cost" type="RichTextLabel" parent="Control/Upgrade"] modulate = Color(1, 0.812823, 0.471338, 1) clip_contents = false layout_mode = 0 @@ -101,17 +105,23 @@ offset_bottom = 86.24 bbcode_enabled = true text = "[center]20G" -[node name="MouseHandler" parent="Control/HBoxContainer/Upgrade" instance=ExtResource("4_3uk60")] +[node name="MouseHandler" parent="Control/Upgrade" instance=ExtResource("4_3uk60")] -[node name="CollisionShape2D" type="CollisionShape2D" parent="Control/HBoxContainer/Upgrade/MouseHandler"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="Control/Upgrade/MouseHandler"] position = Vector2(16.5, 20) shape = SubResource("RectangleShape2D_ehvvg") -[node name="Upgrade2" type="ColorRect" parent="Control/HBoxContainer"] +[node name="Upgrade2" type="TextureRect" parent="Control"] custom_minimum_size = Vector2(32, 40) layout_mode = 2 +offset_left = 96.5 +offset_top = 42.5 +offset_right = 128.5 +offset_bottom = 82.5 +pivot_offset = Vector2(16, 20) +texture = ExtResource("6_yrfvb") -[node name="Card2Title" type="RichTextLabel" parent="Control/HBoxContainer/Upgrade2"] +[node name="Card2Title" type="RichTextLabel" parent="Control/Upgrade2"] clip_contents = false layout_mode = 0 offset_left = -22.885 @@ -121,7 +131,7 @@ offset_bottom = 27.685 bbcode_enabled = true text = "[center]Test Title" -[node name="Card2Cost" type="RichTextLabel" parent="Control/HBoxContainer/Upgrade2"] +[node name="Card2Cost" type="RichTextLabel" parent="Control/Upgrade2"] modulate = Color(1, 0.812823, 0.471338, 1) clip_contents = false layout_mode = 0 @@ -132,17 +142,23 @@ offset_bottom = 86.24 bbcode_enabled = true text = "[center]20G" -[node name="MouseHandler2" parent="Control/HBoxContainer/Upgrade2" instance=ExtResource("4_3uk60")] +[node name="MouseHandler2" parent="Control/Upgrade2" instance=ExtResource("4_3uk60")] -[node name="CollisionShape2D" type="CollisionShape2D" parent="Control/HBoxContainer/Upgrade2/MouseHandler2"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="Control/Upgrade2/MouseHandler2"] position = Vector2(16.5, 20) shape = SubResource("RectangleShape2D_ehvvg") -[node name="Upgrade3" type="ColorRect" parent="Control/HBoxContainer"] +[node name="Upgrade3" type="TextureRect" parent="Control"] custom_minimum_size = Vector2(32, 40) layout_mode = 2 +offset_left = 165.5 +offset_top = 42.5 +offset_right = 197.5 +offset_bottom = 82.5 +pivot_offset = Vector2(16, 20) +texture = ExtResource("6_yrfvb") -[node name="ZoneTitle" type="RichTextLabel" parent="Control/HBoxContainer/Upgrade3"] +[node name="ZoneTitle" type="RichTextLabel" parent="Control/Upgrade3"] clip_contents = false layout_mode = 0 offset_left = -22.885 @@ -152,7 +168,7 @@ offset_bottom = 27.685 bbcode_enabled = true text = "[center]Test Title" -[node name="ZoneCost" type="RichTextLabel" parent="Control/HBoxContainer/Upgrade3"] +[node name="ZoneCost" type="RichTextLabel" parent="Control/Upgrade3"] modulate = Color(1, 0.812823, 0.471338, 1) clip_contents = false layout_mode = 0 @@ -163,12 +179,34 @@ offset_bottom = 86.24 bbcode_enabled = true text = "[center]20G" -[node name="MouseHandler3" parent="Control/HBoxContainer/Upgrade3" instance=ExtResource("4_3uk60")] +[node name="MouseHandler3" parent="Control/Upgrade3" instance=ExtResource("4_3uk60")] -[node name="CollisionShape2D" type="CollisionShape2D" parent="Control/HBoxContainer/Upgrade3/MouseHandler3"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="Control/Upgrade3/MouseHandler3"] position = Vector2(16.5, 20) shape = SubResource("RectangleShape2D_ehvvg") -[connection signal="clicked" from="Control/HBoxContainer/Upgrade/MouseHandler" to="Control" method="_on_mouse_handler_clicked"] -[connection signal="clicked" from="Control/HBoxContainer/Upgrade2/MouseHandler2" to="Control" method="_on_mouse_handler_2_clicked"] -[connection signal="clicked" from="Control/HBoxContainer/Upgrade3/MouseHandler3" to="Control" method="_on_mouse_handler_3_clicked"] +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource("6_wvbe0") +volume_db = -10.0 + +[node name="AudioStreamPlayer2" type="AudioStreamPlayer" parent="."] +stream = ExtResource("7_wsmt1") +volume_db = -15.0 + +[node name="AudioStreamPlayer3" type="AudioStreamPlayer" parent="."] +stream = ExtResource("8_csgwn") +volume_db = -10.0 + +[node name="AudioStreamPlayer4" type="AudioStreamPlayer" parent="."] +stream = ExtResource("9_fxutd") +volume_db = 5.0 + +[connection signal="clicked" from="Control/Upgrade/MouseHandler" to="Control" method="_on_mouse_handler_clicked"] +[connection signal="hovered" from="Control/Upgrade/MouseHandler" to="Control" method="_on_mouse_handler_hovered"] +[connection signal="unhovered" from="Control/Upgrade/MouseHandler" to="Control" method="_on_mouse_handler_unhovered"] +[connection signal="clicked" from="Control/Upgrade2/MouseHandler2" to="Control" method="_on_mouse_handler_2_clicked"] +[connection signal="hovered" from="Control/Upgrade2/MouseHandler2" to="Control" method="_on_mouse_handler_2_hovered"] +[connection signal="unhovered" from="Control/Upgrade2/MouseHandler2" to="Control" method="_on_mouse_handler_unhovered"] +[connection signal="clicked" from="Control/Upgrade3/MouseHandler3" to="Control" method="_on_mouse_handler_3_clicked"] +[connection signal="hovered" from="Control/Upgrade3/MouseHandler3" to="Control" method="_on_mouse_handler_3_hovered"] +[connection signal="unhovered" from="Control/Upgrade3/MouseHandler3" to="Control" method="_on_mouse_handler_unhovered"] diff --git a/src/Coin.tscn b/src/Coin.tscn new file mode 100644 index 0000000..b1ebd9c --- /dev/null +++ b/src/Coin.tscn @@ -0,0 +1,21 @@ +[gd_scene load_steps=5 format=3 uid="uid://dyd3gq1oc117t"] + +[ext_resource type="PackedScene" uid="uid://dykc1mgg5uopw" path="res://components/Cursor/MouseHandler.tscn" id="1_53keb"] +[ext_resource type="Script" path="res://src/coin.gd" id="1_l62nl"] +[ext_resource type="Texture2D" uid="uid://cndrtahwhbkli" path="res://src/ui/coin.png" id="2_5qokh"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_6mwyk"] +size = Vector2(8, 8) + +[node name="Coin" type="Node2D"] +script = ExtResource("1_l62nl") + +[node name="MouseHandler" parent="." instance=ExtResource("1_53keb")] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="MouseHandler"] +shape = SubResource("RectangleShape2D_6mwyk") + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("2_5qokh") + +[connection signal="hovered" from="MouseHandler" to="." method="_on_mouse_handler_hovered"] diff --git a/src/CreatureWindow.tscn b/src/CreatureWindow.tscn index b0073d5..e0ad1d9 100644 --- a/src/CreatureWindow.tscn +++ b/src/CreatureWindow.tscn @@ -1,15 +1,21 @@ -[gd_scene load_steps=3 format=3 uid="uid://dcaqcebxdrgu7"] +[gd_scene load_steps=4 format=3 uid="uid://dcaqcebxdrgu7"] [ext_resource type="Script" path="res://src/creature_window.gd" id="1_eufhm"] [ext_resource type="PackedScene" uid="uid://dcmh5yv0fjmsb" path="res://MouseSignals.tscn" id="2_3cu4o"] +[ext_resource type="Texture2D" uid="uid://deip0unwxcqno" path="res://wild.png" id="3_bxvic"] [node name="CreatureWindow" type="Window"] canvas_item_default_texture_filter = 0 position = Vector2i(0, 36) size = Vector2i(300, 300) +unresizable = true always_on_top = true content_scale_factor = 4.0 +[node name="Sprite2D" type="Sprite2D" parent="."] +position = Vector2(37.5, 37.5) +texture = ExtResource("3_bxvic") + [node name="Node2D" type="Node2D" parent="."] script = ExtResource("1_eufhm") diff --git a/src/UIButtons.tscn b/src/UIButtons.tscn index 2ee67d2..ac0a464 100644 --- a/src/UIButtons.tscn +++ b/src/UIButtons.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=3 uid="uid://dmsrxabynq46i"] +[gd_scene load_steps=10 format=3 uid="uid://dmsrxabynq46i"] [ext_resource type="Script" path="res://src/buttons.gd" id="1_rc6dx"] [ext_resource type="PackedScene" uid="uid://br46gg7k10wt2" path="res://src/ui/ActionButton.tscn" id="1_ydcg5"] @@ -7,6 +7,8 @@ [ext_resource type="Texture2D" uid="uid://dwabjc45s6l27" path="res://src/ui/quit.png" id="4_6jhet"] [ext_resource type="Texture2D" uid="uid://cblr2row5bl8c" path="res://src/ui/resume.png" id="4_n6ajx"] [ext_resource type="Texture2D" uid="uid://dde40wino3goe" path="res://src/ui/upgrade-close.png" id="6_g4yuf"] +[ext_resource type="AudioStream" uid="uid://c06j2q7c0j6br" path="res://sfx/UI Click 2.wav" id="8_roeob"] +[ext_resource type="AudioStream" uid="uid://co8mnuoislrta" path="res://sfx/UI Click 3.wav" id="9_fsyho"] [node name="UiButtons" type="Window"] transparent_bg = true @@ -29,13 +31,15 @@ image = ExtResource("2_n0s2l") alt_image = ExtResource("4_n6ajx") color = Color(0.991606, 1, 0.496144, 1) -[node name="BuildButton" parent="Node2D" instance=ExtResource("1_ydcg5")] +[node name="BuildButton" parent="Node2D" node_paths=PackedStringArray("on_stream", "off_stream") instance=ExtResource("1_ydcg5")] position = Vector2(28, 32) key = "upgrade_menu" value = "toggle" image = ExtResource("3_qishi") alt_image = ExtResource("6_g4yuf") color = Color(0.680476, 1, 0.652914, 1) +on_stream = NodePath("../AudioStreamPlayer") +off_stream = NodePath("../AudioStreamPlayer2") [node name="QuitButton" parent="Node2D" instance=ExtResource("1_ydcg5")] position = Vector2(28, 51) @@ -43,3 +47,9 @@ key = "quit" value = "value" image = ExtResource("4_6jhet") color = Color(1, 0.734185, 0.691036, 1) + +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="Node2D"] +stream = ExtResource("8_roeob") + +[node name="AudioStreamPlayer2" type="AudioStreamPlayer" parent="Node2D"] +stream = ExtResource("9_fsyho") diff --git a/src/build_window.gd b/src/build_window.gd index 837a137..c2a7a05 100644 --- a/src/build_window.gd +++ b/src/build_window.gd @@ -1,22 +1,27 @@ extends Control -var upgrade_pool = Data.data.upgrades.keys() -var zone_pool = Data.data.zones.keys() - @onready var cards = [ { - "title": $HBoxContainer/Upgrade/Card1Title, - "cost": $HBoxContainer/Upgrade/Card1Cost + "title": $Upgrade/Card1Title, + "cost": $Upgrade/Card1Cost, + "object": $Upgrade }, { - "title": $HBoxContainer/Upgrade2/Card2Title, - "cost": $HBoxContainer/Upgrade2/Card2Cost + "title": $Upgrade2/Card2Title, + "cost": $Upgrade2/Card2Cost, + "object": $Upgrade2 }, { - "title": $HBoxContainer/Upgrade3/ZoneTitle, - "cost": $HBoxContainer/Upgrade3/ZoneCost + "title": $Upgrade3/ZoneTitle, + "cost": $Upgrade3/ZoneCost, + "object": $Upgrade3 } ] +@onready var description_text: RichTextLabel = $DescriptionText +@onready var audio_stream_player: AudioStreamPlayer = $"../AudioStreamPlayer" +@onready var audio_stream_player_2: AudioStreamPlayer = $"../AudioStreamPlayer2" +@onready var audio_stream_player_3: AudioStreamPlayer = $"../AudioStreamPlayer3" +@onready var audio_stream_player_4: AudioStreamPlayer = $"../AudioStreamPlayer4" var chosen_cards = [ null, @@ -24,10 +29,35 @@ var chosen_cards = [ null ] +@onready var main = get_tree().root.get_child(7) + +var tweens = [ + null, + null, + null +] + +var buy_tweens = [ + null, + null, + null +] + +var cost_tweens = [ + null, + null, + null +] + +var buying = [ + false, + false, + false +] + func _ready() -> void: - upgrade_pool.shuffle() - zone_pool.shuffle() - Persister.change_value("gold", 100) # TEMP + main.upgrade_pool.shuffle() + main.zone_pool.shuffle() var screen_size = DisplayServer.screen_get_size(0) @@ -46,17 +76,18 @@ func _update_card(index): var cost if index == 2: - if zone_pool.size() == 0: - zone_pool = Data.data.zones.keys() - zone_pool.shuffle() - choice = zone_pool.pop_back() + if main.zone_pool.size() == 0: + main.zone_pool = Data.data.zones.keys() + main.zone_pool.shuffle() + choice = main.zone_pool.pop_back() card_data = Data.data.zones[choice] cost = 20 + cards[index].object.texture = Data.data.images["%s-card" % [choice]] else: - if upgrade_pool.size() == 0: - upgrade_pool = Data.data.upgrades.keys() - upgrade_pool.shuffle() - choice = upgrade_pool.pop_back() + if main.upgrade_pool.size() == 0: + main.upgrade_pool = Data.data.upgrades.keys() + main.upgrade_pool.shuffle() + choice = main.upgrade_pool.pop_back() card_data = Data.data.upgrades[choice] cost = card_data.cost @@ -78,11 +109,84 @@ func _on_mouse_handler_3_clicked() -> void: _buy_upgrade(2) +func _hover_upgrade(index): + audio_stream_player_4.play() + var card_data = chosen_cards[index] + description_text.text = "[center]%s" % [card_data.description] + + if tweens[index]: + tweens[index].kill + + tweens[index] = create_tween() + tweens[index].set_ease(Tween.EASE_OUT) + tweens[index].set_trans(Tween.TRANS_BACK) + tweens[index].set_parallel() + tweens[index].tween_property(cards[index].title, "modulate", Color.GOLD, 0.25) + tweens[index].tween_property(cards[index].object, "position:y", 35, 0.25) + + func _buy_upgrade(index): + if buying[index]: + return + var card_data = chosen_cards[index] if Persister.get_value("gold", PersisterEnums.Scope.UNKNOWN, 0) >= (card_data.cost if card_data.has("cost") else 20): Persister.change_value("gold", -(card_data.cost if card_data.has("cost") else 20)) - _update_card(index) + + buying[index] = true + + if buy_tweens[index]: + buy_tweens[index].kill() + + buy_tweens[index] = create_tween() + buy_tweens[index].tween_property(cards[index].object, "scale:x", 0, 0.125) + buy_tweens[index].tween_callback(func(): + _update_card(index) + ) + buy_tweens[index].tween_property(cards[index].object, "scale:x", 1, 0.125) + buy_tweens[index].tween_callback(func(): + buying[index] = false + ) if index == 2: Triggerer.trigger("spawn_window", {"key": card_data.key}) + audio_stream_player_2.play() + else: + Persister.change_value(card_data.property, card_data.amount) + audio_stream_player.play() + else: + audio_stream_player_3.play() + + if cost_tweens[index]: + cost_tweens[index].kill() + + cost_tweens[index] = create_tween() + cost_tweens[index].tween_property(cards[index].cost, "modulate", Color.RED, 0.125) + cost_tweens[index].tween_property(cards[index].cost, "modulate", Color.html("#ffcf78"), 0.125) + + +func _on_mouse_handler_hovered() -> void: + _hover_upgrade(0) + + +func _on_mouse_handler_2_hovered() -> void: + _hover_upgrade(1) + + +func _on_mouse_handler_3_hovered() -> void: + _hover_upgrade(2) + + +func _on_mouse_handler_unhovered() -> void: + description_text.text = "" + + for index in range(0, 3): + if tweens[index]: + tweens[index].kill + + tweens[index] = create_tween() + tweens[index].set_ease(Tween.EASE_OUT) + tweens[index].set_trans(Tween.TRANS_QUAD) + tweens[index].set_parallel() + tweens[index].tween_property(cards[index].title, "modulate", Color.WHITE, 0.25) + tweens[index].tween_property(cards[index].object, "position:y", 42.5, 0.25) diff --git a/src/coin.gd b/src/coin.gd new file mode 100644 index 0000000..9868ef4 --- /dev/null +++ b/src/coin.gd @@ -0,0 +1,6 @@ +extends Node2D + + +func _on_mouse_handler_hovered() -> void: + Persister.change_value("gold", 1) + queue_free() diff --git a/src/creature.gd b/src/creature.gd index f4d6255..33ddbc4 100644 --- a/src/creature.gd +++ b/src/creature.gd @@ -7,9 +7,20 @@ var key @onready var sprite_2d: Sprite2D = $Sprite2D +const COIN = preload("res://src/Coin.tscn") + +var held = false func _ready() -> void: sprite_2d.texture = image + Triggerer.listen("hour", _on_hour) + + +func _on_hour(_data): + if not held and randf() < (Persister.get_value("creature_resource_spawn_rate") / 100.0): + var new_coin = COIN.instantiate() + new_coin.global_position = global_position + get_window().add_child(new_coin) func _on_mouse_handler_clicked() -> void: diff --git a/src/ui/action_button.gd b/src/ui/action_button.gd index 312a37e..5bf38e6 100644 --- a/src/ui/action_button.gd +++ b/src/ui/action_button.gd @@ -4,6 +4,8 @@ extends Node2D @export var image: Texture2D @export var alt_image: Texture2D @export var color: Color +@export var on_stream: AudioStreamPlayer +@export var off_stream: AudioStreamPlayer var size_tween @@ -23,6 +25,11 @@ func _on_mouse_handler_clicked() -> void: sprite_2d.texture = image else: sprite_2d.texture = alt_image + + if old_value and on_stream: + on_stream.play() + elif not old_value and off_stream: + off_stream.play() else: Persister.persist_data(key, value) diff --git a/wall.aseprite b/wall.aseprite new file mode 100644 index 0000000..58cb9d2 Binary files /dev/null and b/wall.aseprite differ diff --git a/wall.png b/wall.png new file mode 100644 index 0000000..55d6707 Binary files /dev/null and b/wall.png differ diff --git a/wall.png.import b/wall.png.import new file mode 100644 index 0000000..f2af3f8 --- /dev/null +++ b/wall.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://5by2gsqdfjju" +path="res://.godot/imported/wall.png-e3261c66ad83b71f524576fb4f3c7b5b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://wall.png" +dest_files=["res://.godot/imported/wall.png-e3261c66ad83b71f524576fb4f3c7b5b.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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/wild.aseprite b/wild.aseprite new file mode 100644 index 0000000..b332abd Binary files /dev/null and b/wild.aseprite differ diff --git a/wild.png b/wild.png new file mode 100644 index 0000000..ef36e1d Binary files /dev/null and b/wild.png differ diff --git a/wild.png.import b/wild.png.import new file mode 100644 index 0000000..9401008 --- /dev/null +++ b/wild.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://deip0unwxcqno" +path="res://.godot/imported/wild.png-3d1a4abd36cfbc7788377fee4951f545.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://wild.png" +dest_files=["res://.godot/imported/wild.png-3d1a4abd36cfbc7788377fee4951f545.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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