From 2c4b6247b61ce160a84f662074adb86df5002f58 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 2 May 2024 05:42:45 +0200 Subject: [PATCH] final fix --- behaviours/eater.gd | 2 ++ entities/barn.gd | 1 + entities/chupacabra.tscn | 7 +++++-- entities/cthulhu.gd | 8 ++++++++ entities/cthulhu.tscn | 17 ++++++++++++++++- entities/gold.tscn | 21 ++++++++++++++++++++- entities/imp.tscn | 4 +++- entities/sheep.tscn | 3 +++ entities/watcher.tscn | 6 ++++-- scenes/game/main_game.gd | 8 +++++++- scenes/game/main_game.tscn | 36 +++++++++++++++++++++++++++++++++++- 11 files changed, 104 insertions(+), 9 deletions(-) diff --git a/behaviours/eater.gd b/behaviours/eater.gd index 3ec6028..3f0ef03 100644 --- a/behaviours/eater.gd +++ b/behaviours/eater.gd @@ -27,6 +27,8 @@ func plus_one(): if count == target: goal_reached.emit() +func clear_diets() -> void: + acceptable_diets = [] func _on_body_entered(body: Node2D) -> void: diff --git a/entities/barn.gd b/entities/barn.gd index b7e479a..212d2ff 100644 --- a/entities/barn.gd +++ b/entities/barn.gd @@ -33,6 +33,7 @@ func _on_animation_finished(anim_name:StringName) -> void: func _on_sheep_spawned(entity: Node2D) -> void: entity.get_node("MovementBarn/BarnPriority").priority_alternative() + entity.get_node("MovementBarn").speed *= animator.speed_scale animator.speed_scale += 0.04 if Random.rng.randi_range(0, 20) == 0: entity.get_node("Sprite/TopHatter").plus_one() diff --git a/entities/chupacabra.tscn b/entities/chupacabra.tscn index 1eb852c..91a87af 100644 --- a/entities/chupacabra.tscn +++ b/entities/chupacabra.tscn @@ -451,8 +451,9 @@ scene = ExtResource("14_nw8pn") [node name="SpawnTimer" parent="GoldSpawner" instance=ExtResource("6_qsds3")] autostart = true -min_secs = 0.2 -max_secs = 1.8 +mean_secs = 0.7 +min_secs = 0.1 +max_secs = 1.3 [node name="MovementSampler" parent="." instance=ExtResource("7_nq78n")] @@ -559,12 +560,14 @@ stream = ExtResource("17_ccla5") bus = &"KillSounds" [connection signal="eaten" from="Sprite/TopHatter" to="." method="_on_eater_eaten"] +[connection signal="eaten" from="Sprite/TopHatter" to="Sprite/TopHatter" method="clear_diets" unbinds=1] [connection signal="eaten" from="Sprite/TopHatter" to="Sprite/TopHatter/Spawner" method="enable" unbinds=1] [connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sprite" method="show"] [connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sacrificable" method="set_kind" binds= [&"TopHat"]] [connection signal="tree_exiting" from="Sprite/TopHatter/Spawner" to="Sprite/TopHatter/Spawner" method="spawn"] [connection signal="sacrificed" from="Sprite/TopHatter/Sacrificable" to="." method="queue_free"] [connection signal="eaten" from="Sprite/Monocler" to="." method="_on_eater_eaten"] +[connection signal="eaten" from="Sprite/Monocler" to="Sprite/Monocler" method="clear_diets" unbinds=1] [connection signal="eaten" from="Sprite/Monocler" to="Sprite/Monocler/Spawner" method="enable" unbinds=1] [connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sprite" method="show"] [connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sacrificable" method="set_kind" binds= [&"Monocles"]] diff --git a/entities/cthulhu.gd b/entities/cthulhu.gd index 2fcc1fd..479bb54 100644 --- a/entities/cthulhu.gd +++ b/entities/cthulhu.gd @@ -35,3 +35,11 @@ func _on_fallen() -> void: func _on_eater_eaten(edible: Edible) -> void: edible.get_parent().queue_free() + +func _on_gold_spawner_spawned(entity:Node2D) -> void: + entity.scale *= 2 + entity.get_node("Collectible").quantity = 25 + entity.get_node("MoveStraight").randomize_direction() + entity.get_node("MoveStraight/Priority").priority_alternative() + + diff --git a/entities/cthulhu.tscn b/entities/cthulhu.tscn index 9e7f490..719ee24 100644 --- a/entities/cthulhu.tscn +++ b/entities/cthulhu.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=28 format=3 uid="uid://gl4umoff474y"] +[gd_scene load_steps=30 format=3 uid="uid://gl4umoff474y"] [ext_resource type="PackedScene" uid="uid://bxbjfev0lhwws" path="res://behaviours/sprite_left_right.tscn" id="1_a8ato"] [ext_resource type="Script" path="res://entities/cthulhu.gd" id="1_b55wc"] @@ -19,6 +19,8 @@ [ext_resource type="AudioStream" uid="uid://cwsg776c11xfc" path="res://entities/fall.ogg" id="12_v8da5"] [ext_resource type="PackedScene" uid="uid://jg7qkbswgqjc" path="res://behaviours/eater.tscn" id="15_vopba"] [ext_resource type="AudioStream" uid="uid://c1yuksnjdd6g2" path="res://entities/imp_eat.ogg" id="19_3hopf"] +[ext_resource type="PackedScene" uid="uid://uoxwjpmgg27a" path="res://entities/gold.tscn" id="20_nykad"] +[ext_resource type="PackedScene" uid="uid://g8t6dt0ye6n3" path="res://behaviours/timer_stddev.tscn" id="21_js0id"] [sub_resource type="CircleShape2D" id="CircleShape2D_wjkbi"] radius = 28.0 @@ -306,11 +308,22 @@ bus = &"KillSounds" shape = SubResource("CircleShape2D_4bt8o") debug_color = Color(1, 0, 0, 0) +[node name="GoldSpawner" parent="." instance=ExtResource("7_op2gq")] +scene = ExtResource("20_nykad") + +[node name="SpawnTimer" parent="GoldSpawner" instance=ExtResource("21_js0id")] +autostart = true +mean_secs = 0.15 +min_secs = 0.05 +max_secs = 0.3 + [connection signal="eaten" from="SpriteFocus/Sprite/TopHatter" to="." method="_on_eater_eaten"] +[connection signal="eaten" from="SpriteFocus/Sprite/TopHatter" to="SpriteFocus/Sprite/TopHatter" method="clear_diets" unbinds=1] [connection signal="eaten" from="SpriteFocus/Sprite/TopHatter" to="SpriteFocus/Sprite/TopHatter/Spawner" method="enable" unbinds=1] [connection signal="goal_reached" from="SpriteFocus/Sprite/TopHatter" to="SpriteFocus/Sprite/TopHatter/Sprite" method="show"] [connection signal="tree_exiting" from="SpriteFocus/Sprite/TopHatter/Spawner" to="SpriteFocus/Sprite/TopHatter/Spawner" method="spawn"] [connection signal="eaten" from="SpriteFocus/Sprite/Monocler" to="." method="_on_eater_eaten"] +[connection signal="eaten" from="SpriteFocus/Sprite/Monocler" to="SpriteFocus/Sprite/Monocler" method="clear_diets" unbinds=1] [connection signal="eaten" from="SpriteFocus/Sprite/Monocler" to="SpriteFocus/Sprite/Monocler/Spawner" method="enable" unbinds=1] [connection signal="goal_reached" from="SpriteFocus/Sprite/Monocler" to="SpriteFocus/Sprite/Monocler/Sprite" method="show"] [connection signal="tree_exiting" from="SpriteFocus/Sprite/Monocler/Spawner" to="SpriteFocus/Sprite/Monocler/Spawner" method="spawn"] @@ -325,3 +338,5 @@ debug_color = Color(1, 0, 0, 0) [connection signal="dropped" from="MovementDrag/Draggable" to="MovementDrag" method="drop"] [connection signal="eaten" from="Eater" to="." method="_on_eater_eaten"] [connection signal="eaten" from="Eater" to="Eater/EatSound" method="play" unbinds=1] +[connection signal="spawned" from="GoldSpawner" to="." method="_on_gold_spawner_spawned"] +[connection signal="timeout" from="GoldSpawner/SpawnTimer" to="GoldSpawner" method="spawn"] diff --git a/entities/gold.tscn b/entities/gold.tscn index 2743164..7eeeb4e 100644 --- a/entities/gold.tscn +++ b/entities/gold.tscn @@ -1,12 +1,15 @@ -[gd_scene load_steps=10 format=3 uid="uid://uoxwjpmgg27a"] +[gd_scene load_steps=13 format=3 uid="uid://uoxwjpmgg27a"] [ext_resource type="Script" path="res://entities/gold.gd" id="1_lbls1"] [ext_resource type="PackedScene" uid="uid://dj72yshd25ucx" path="res://behaviours/collectible.tscn" id="2_j75yq"] [ext_resource type="Texture2D" uid="uid://bfl0tkg85cvb8" path="res://entities/gold.png" id="2_tt3v6"] [ext_resource type="PackedScene" uid="uid://cbg5kgwxusvxf" path="res://behaviours/cursor_detector.tscn" id="3_ne3sj"] [ext_resource type="PackedScene" uid="uid://cml7rqvyfuagx" path="res://behaviours/move_towards.tscn" id="5_bcbgf"] +[ext_resource type="PackedScene" uid="uid://djcwis8ycrq85" path="res://behaviours/sampler_priority.tscn" id="5_h84r5"] [ext_resource type="PackedScene" uid="uid://tx1qi6ahlxjp" path="res://behaviours/spawner.tscn" id="5_t7ey8"] [ext_resource type="PackedScene" uid="uid://eqg6snsgn1kh" path="res://players/gold_pickup_player.tscn" id="6_eoeje"] +[ext_resource type="PackedScene" uid="uid://cm67ko1k6kn4u" path="res://behaviours/priority.tscn" id="7_5jbm6"] +[ext_resource type="PackedScene" uid="uid://dk1ipq7dhkhf3" path="res://behaviours/move_straight.tscn" id="8_a0co5"] [sub_resource type="CircleShape2D" id="CircleShape2D_w1h35"] radius = 96.0 @@ -41,14 +44,30 @@ z_index = -1 shape = SubResource("CircleShape2D_jm7yp") debug_color = Color(0, 1, 0.701961, 0.294118) +[node name="SamplerPriority" parent="." instance=ExtResource("5_h84r5")] + +[node name="MoveStraight" parent="." instance=ExtResource("8_a0co5")] +speed = 133.0 + +[node name="Priority" parent="MoveStraight" instance=ExtResource("7_5jbm6")] +alternative_priority = 5 + [node name="MoveTowards" parent="." instance=ExtResource("5_bcbgf")] unique_name_in_owner = true +[node name="Priority" parent="MoveTowards" instance=ExtResource("7_5jbm6")] +alternative_priority = 10 + [node name="CollectSoundSpawner" parent="." instance=ExtResource("5_t7ey8")] unique_name_in_owner = true scale = Vector2(1.66667, 1.66667) scene = ExtResource("6_eoeje") +[node name="DeleteIfNotOnScreen" type="VisibleOnScreenNotifier2D" parent="."] + [connection signal="cursor_entered" from="MagnetizeArea" to="." method="magnetize"] [connection signal="cursor_entered" from="CollectArea" to="." method="collect" unbinds=1] +[connection signal="move" from="MoveStraight" to="." method="_on_move"] +[connection signal="changed_target" from="MoveTowards" to="MoveTowards/Priority" method="priority_conditional"] [connection signal="move" from="MoveTowards" to="." method="_on_move"] +[connection signal="screen_exited" from="DeleteIfNotOnScreen" to="." method="queue_free"] diff --git a/entities/imp.tscn b/entities/imp.tscn index aed73d8..3887d03 100644 --- a/entities/imp.tscn +++ b/entities/imp.tscn @@ -321,7 +321,7 @@ scene = ExtResource("5_yrfoq") [node name="SpawnTimer" parent="GoldSpawner" instance=ExtResource("10_phvea")] autostart = true -mean_secs = 3.0 +mean_secs = 3.4 min_secs = 1.0 max_secs = 5.0 @@ -416,12 +416,14 @@ stream = ExtResource("19_7la6c") bus = &"KillSounds" [connection signal="eaten" from="Sprite/TopHatter" to="." method="_on_eater_eaten"] +[connection signal="eaten" from="Sprite/TopHatter" to="Sprite/TopHatter" method="clear_diets" unbinds=1] [connection signal="eaten" from="Sprite/TopHatter" to="Sprite/TopHatter/Spawner" method="enable" unbinds=1] [connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sprite" method="show"] [connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sacrificable" method="set_kind" binds= [&"Monocle"]] [connection signal="tree_exiting" from="Sprite/TopHatter/Spawner" to="Sprite/TopHatter/Spawner" method="spawn"] [connection signal="sacrificed" from="Sprite/TopHatter/Sacrificable" to="." method="queue_free"] [connection signal="eaten" from="Sprite/Monocler" to="." method="_on_eater_eaten"] +[connection signal="eaten" from="Sprite/Monocler" to="Sprite/Monocler" method="clear_diets" unbinds=1] [connection signal="eaten" from="Sprite/Monocler" to="Sprite/Monocler/Spawner" method="enable" unbinds=1] [connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sprite" method="show"] [connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sacrificable" method="set_kind" binds= [&"Monocle"]] diff --git a/entities/sheep.tscn b/entities/sheep.tscn index 2e82b79..f59fb96 100644 --- a/entities/sheep.tscn +++ b/entities/sheep.tscn @@ -410,11 +410,14 @@ stream = ExtResource("17_8kst2") bus = &"FallSounds" [connection signal="eaten" from="Sprite/TopHatter" to="." method="_on_eater_eaten"] +[connection signal="eaten" from="Sprite/TopHatter" to="Sprite/TopHatter" method="clear_diets" unbinds=1] [connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sprite" method="show"] [connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Spawner" method="enable"] +[connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sacrificable" method="set_kind" binds= [&"TopHat"]] [connection signal="tree_exiting" from="Sprite/TopHatter/Spawner" to="Sprite/TopHatter/Spawner" method="spawn"] [connection signal="sacrificed" from="Sprite/TopHatter/Sacrificable" to="." method="queue_free"] [connection signal="eaten" from="Sprite/Monocler" to="." method="_on_eater_eaten"] +[connection signal="eaten" from="Sprite/Monocler" to="Sprite/Monocler" method="clear_diets" unbinds=1] [connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sprite" method="show"] [connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Spawner" method="enable"] [connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sacrificable" method="set_kind" binds= [&"Monocle"]] diff --git a/entities/watcher.tscn b/entities/watcher.tscn index fd891e0..7ec66d7 100644 --- a/entities/watcher.tscn +++ b/entities/watcher.tscn @@ -322,8 +322,8 @@ scene = ExtResource("14_cfqh8") [node name="SpawnTimer" parent="GoldSpawner" instance=ExtResource("11_20lvf")] autostart = true -mean_secs = 0.2 -min_secs = 0.1 +mean_secs = 0.15 +min_secs = 0.05 max_secs = 0.3 [node name="MovementSampler" parent="." instance=ExtResource("4_i1htf")] @@ -415,12 +415,14 @@ stream = ExtResource("20_bdcer") bus = &"KillSounds" [connection signal="eaten" from="Sprite/TopHatter" to="." method="_on_eater_eaten"] +[connection signal="eaten" from="Sprite/TopHatter" to="Sprite/TopHatter" method="clear_diets" unbinds=1] [connection signal="eaten" from="Sprite/TopHatter" to="Sprite/TopHatter/Spawner" method="enable" unbinds=1] [connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sprite" method="show"] [connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sacrificable" method="set_kind" binds= [&"TopHat"]] [connection signal="tree_exiting" from="Sprite/TopHatter/Spawner" to="Sprite/TopHatter/Spawner" method="spawn"] [connection signal="sacrificed" from="Sprite/TopHatter/Sacrificable" to="." method="queue_free"] [connection signal="eaten" from="Sprite/Monocler" to="." method="_on_eater_eaten"] +[connection signal="eaten" from="Sprite/Monocler" to="Sprite/Monocler" method="clear_diets" unbinds=1] [connection signal="eaten" from="Sprite/Monocler" to="Sprite/Monocler/Spawner" method="enable" unbinds=1] [connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sprite" method="show"] [connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sacrificable" method="set_kind" binds= [&"Monocle"]] diff --git a/scenes/game/main_game.gd b/scenes/game/main_game.gd index d77f1d5..d6cc2b2 100644 --- a/scenes/game/main_game.gd +++ b/scenes/game/main_game.gd @@ -23,7 +23,7 @@ func _ready(): gold_counter.changed.connect(cursor.gold_display.change) cursor.gold_display.set_text(gold_counter.value) -func _on_recipe_matched(m: SummoningRecipe.Match, recipe: SummoningRecipe) -> void: +func _on_recipe_matched(_m: SummoningRecipe.Match, recipe: SummoningRecipe) -> void: # Quick hack for now match recipe.name: "FiveSheep": @@ -31,5 +31,11 @@ func _on_recipe_matched(m: SummoningRecipe.Match, recipe: SummoningRecipe) -> vo music.do_sync() "FiveImps": music.enable_layer_2() + "ASkull": + music.enable_layer_2() "FiveChupacabra": music.enable_layer_3() + "FiveTopHats": + music.enable_layer_3() + "FiveMonocles": + music.enable_layer_3() diff --git a/scenes/game/main_game.tscn b/scenes/game/main_game.tscn index ff64618..0b309df 100644 --- a/scenes/game/main_game.tscn +++ b/scenes/game/main_game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=20 format=3 uid="uid://cxj5aud02f40j"] +[gd_scene load_steps=21 format=3 uid="uid://cxj5aud02f40j"] [ext_resource type="Script" path="res://scenes/game/main_game.gd" id="1_wiglu"] [ext_resource type="PackedScene" uid="uid://dm068vaseh45n" path="res://scenes/game/game_camera.tscn" id="2_db5xs"] @@ -10,6 +10,7 @@ [ext_resource type="PackedScene" uid="uid://col1q3elvkfwk" path="res://scenes/game/cursor.tscn" id="5_g504x"] [ext_resource type="Texture2D" uid="uid://bxm3edor0akqj" path="res://scenes/game/tileset_flowers_shaded.png" id="5_yqthh"] [ext_resource type="PackedScene" uid="uid://uoxwjpmgg27a" path="res://entities/gold.tscn" id="13_56o7t"] +[ext_resource type="PackedScene" uid="uid://gl4umoff474y" path="res://entities/cthulhu.tscn" id="14_gmddv"] [ext_resource type="PackedScene" uid="uid://cgpwig0rd08vh" path="res://entities/summoning_circle_pentagram.tscn" id="16_nhsrb"] [ext_resource type="PackedScene" uid="uid://db246fkcf452d" path="res://entities/tree.tscn" id="18_r8twr"] [ext_resource type="PackedScene" uid="uid://cn0p5s44h86px" path="res://entities/barn.tscn" id="20_tek4w"] @@ -1053,6 +1054,36 @@ position = Vector2(-520, -140) [node name="Gold25" parent="Entities" instance=ExtResource("13_56o7t")] position = Vector2(-540, -160) +[node name="Gold26" parent="Entities" instance=ExtResource("13_56o7t")] +position = Vector2(460, -240) + +[node name="Gold27" parent="Entities" instance=ExtResource("13_56o7t")] +position = Vector2(420, -280) + +[node name="Gold31" parent="Entities" instance=ExtResource("13_56o7t")] +position = Vector2(440, -240) + +[node name="Gold32" parent="Entities" instance=ExtResource("13_56o7t")] +position = Vector2(420, -240) + +[node name="Gold33" parent="Entities" instance=ExtResource("13_56o7t")] +position = Vector2(400, -240) + +[node name="Gold34" parent="Entities" instance=ExtResource("13_56o7t")] +position = Vector2(380, -240) + +[node name="Gold35" parent="Entities" instance=ExtResource("13_56o7t")] +position = Vector2(360, -240) + +[node name="Gold28" parent="Entities" instance=ExtResource("13_56o7t")] +position = Vector2(420, -200) + +[node name="Gold29" parent="Entities" instance=ExtResource("13_56o7t")] +position = Vector2(440, -220) + +[node name="Gold30" parent="Entities" instance=ExtResource("13_56o7t")] +position = Vector2(440, -260) + [node name="Tree20" parent="Entities" instance=ExtResource("18_r8twr")] position = Vector2(-520, 200) @@ -1077,4 +1108,7 @@ position = Vector2(-160, 420) [node name="Tree27" parent="Entities" instance=ExtResource("18_r8twr")] position = Vector2(120, 480) +[node name="Cthulhu" parent="." instance=ExtResource("14_gmddv")] +position = Vector2(-20, 200) + [connection signal="recipe_matched" from="Entities/SummoningCirclePentagram" to="." method="_on_recipe_matched"]