From dc1a239471f04fec8fae32c897c40bbf4739ff75 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 30 Apr 2024 05:17:57 +0200 Subject: [PATCH] Make entities put on hat and monocle --- behaviours/eater.gd | 11 ++++++++ behaviours/sprite_left_right.gd | 4 +++ entities/chupacabra.tscn | 48 ++++++++++++++++++++++++++++++--- entities/cthulhu.gd | 3 +++ entities/cthulhu.tscn | 48 ++++++++++++++++++++++++++++++++- entities/imp.tscn | 45 ++++++++++++++++++++++++++++++- entities/monocle.tscn | 6 ++++- entities/sheep.gd | 3 +++ entities/sheep.tscn | 48 ++++++++++++++++++++++++++++++++- entities/top_hat.tscn | 6 ++++- entities/watcher.tscn | 45 ++++++++++++++++++++++++++++++- 11 files changed, 257 insertions(+), 10 deletions(-) diff --git a/behaviours/eater.gd b/behaviours/eater.gd index 2a0c563..f8fe903 100644 --- a/behaviours/eater.gd +++ b/behaviours/eater.gd @@ -7,9 +7,17 @@ class_name Eater signal eaten(edible: Edible) +## Emitted when the [field goal] number of entities has been eaten. +signal goal_reached + @export var acceptable_diets: Array[StringName] = [] +@export var target = -1 + +## Count of how many times something was eaten. +var count: int = 0 + func log_eaten(edible: Edible) -> void: Log.p(self, "Eaten: %s" % edible) @@ -21,3 +29,6 @@ func _on_body_entered(body: Node2D) -> void: if edible.diet in acceptable_diets: eaten.emit(edible) edible.eat() + count += 1 + if count == target: + goal_reached.emit() diff --git a/behaviours/sprite_left_right.gd b/behaviours/sprite_left_right.gd index 3186ae1..5942b96 100644 --- a/behaviours/sprite_left_right.gd +++ b/behaviours/sprite_left_right.gd @@ -13,7 +13,11 @@ func handle_move(movement: Vector2): discrim = last_discrim if discrim > 0: texture = right_texture + for child in get_children(): + child.scale.x = -abs(child.scale.x) last_discrim = discrim elif discrim < 0: texture = left_texture + for child in get_children(): + child.scale.x = abs(child.scale.x) last_discrim = discrim diff --git a/entities/chupacabra.tscn b/entities/chupacabra.tscn index 2b13d80..9005ac9 100644 --- a/entities/chupacabra.tscn +++ b/entities/chupacabra.tscn @@ -1,10 +1,12 @@ -[gd_scene load_steps=34 format=3 uid="uid://cmemgijh6nfmk"] +[gd_scene load_steps=36 format=3 uid="uid://cmemgijh6nfmk"] [ext_resource type="PackedScene" uid="uid://bxbjfev0lhwws" path="res://behaviours/sprite_left_right.tscn" id="1_11voy"] [ext_resource type="Script" path="res://entities/chupacabra.gd" id="1_s4qg1"] [ext_resource type="Texture2D" uid="uid://dcm4txm5gxogt" path="res://entities/chupacabra_left.png" id="2_3kvme"] [ext_resource type="Texture2D" uid="uid://ba01u171xjl7" path="res://entities/chupacabra_right.png" id="3_rolht"] +[ext_resource type="Texture2D" uid="uid://d3tb6ypb36v8e" path="res://entities/monocle.png" id="5_bcm2q"] [ext_resource type="Texture2D" uid="uid://bpg0do7wlvqdj" path="res://entities/chupacabra_drag_left.png" id="5_hxrq2"] +[ext_resource type="Texture2D" uid="uid://deqvgvf66grr4" path="res://entities/top_hat.png" id="5_qjgou"] [ext_resource type="Texture2D" uid="uid://do1nfcfcs6jgx" path="res://entities/chupacabra_drag_right.png" id="6_kmadh"] [ext_resource type="PackedScene" uid="uid://g8t6dt0ye6n3" path="res://behaviours/timer_stddev.tscn" id="6_qsds3"] [ext_resource type="PackedScene" uid="uid://ccul07w0h36nu" path="res://behaviours/sacrificable.tscn" id="7_igror"] @@ -22,6 +24,9 @@ [ext_resource type="PackedScene" uid="uid://jg7qkbswgqjc" path="res://behaviours/eater.tscn" id="16_ltvqn"] [ext_resource type="AudioStream" uid="uid://c1yuksnjdd6g2" path="res://entities/imp_eat.ogg" id="17_ccla5"] +[sub_resource type="CircleShape2D" id="CircleShape2D_binyt"] +radius = 40.0 + [sub_resource type="CircleShape2D" id="CircleShape2D_mnexs"] radius = 32.0 @@ -354,9 +359,6 @@ radius = 25.19 [sub_resource type="CircleShape2D" id="CircleShape2D_vm5g3"] radius = 32.0 -[sub_resource type="CircleShape2D" id="CircleShape2D_binyt"] -radius = 40.0 - [node name="Chupacabra" type="CharacterBody2D"] y_sort_enabled = true collision_layer = 8 @@ -373,6 +375,40 @@ texture = ExtResource("2_3kvme") left_texture = ExtResource("2_3kvme") right_texture = ExtResource("3_rolht") +[node name="TopHatter" parent="Sprite" instance=ExtResource("16_ltvqn")] +unique_name_in_owner = true +scale = Vector2(0.5, 0.5) +acceptable_diets = Array[StringName]([&"TopHat"]) +target = 1 + +[node name="Sprite" type="Sprite2D" parent="Sprite/TopHatter"] +visible = false +z_index = 1 +position = Vector2(-1, -39) +scale = Vector2(2, 2) +texture = ExtResource("5_qjgou") + +[node name="Shape" type="CollisionShape2D" parent="Sprite/TopHatter"] +shape = SubResource("CircleShape2D_binyt") +debug_color = Color(1, 0, 0, 0) + +[node name="Monocler" parent="Sprite" instance=ExtResource("16_ltvqn")] +unique_name_in_owner = true +scale = Vector2(0.5, 0.5) +acceptable_diets = Array[StringName]([&"Monocle"]) +target = 1 + +[node name="Sprite" type="Sprite2D" parent="Sprite/Monocler"] +visible = false +z_index = 1 +position = Vector2(-9, -17) +scale = Vector2(2, 2) +texture = ExtResource("5_bcm2q") + +[node name="Shape" type="CollisionShape2D" parent="Sprite/Monocler"] +shape = SubResource("CircleShape2D_binyt") +debug_color = Color(1, 0, 0, 0) + [node name="Shape" type="CollisionShape2D" parent="."] shape = SubResource("CircleShape2D_mnexs") @@ -488,6 +524,10 @@ debug_color = Color(1, 0, 0, 0) stream = ExtResource("17_ccla5") bus = &"KillSounds" +[connection signal="eaten" from="Sprite/TopHatter" to="." method="_on_eater_eaten"] +[connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sprite" method="show"] +[connection signal="eaten" from="Sprite/Monocler" to="." method="_on_eater_eaten"] +[connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sprite" method="show"] [connection signal="sacrificed" from="Sacrificable" to="." method="queue_free"] [connection signal="move" from="MovementIdle" to="." method="_on_move"] [connection signal="move_disabled" from="MovementIdle" to="MovementIdle/BoredTimer" method="stop"] diff --git a/entities/cthulhu.gd b/entities/cthulhu.gd index 7d7732f..af1bbbb 100644 --- a/entities/cthulhu.gd +++ b/entities/cthulhu.gd @@ -26,3 +26,6 @@ func _on_fallen() -> void: z_index = Enums.ZIndex.EntityGround y_sort_enabled = true animator.play(&"RESET") + +func _on_eater_eaten(edible: Edible) -> void: + edible.get_parent().queue_free() diff --git a/entities/cthulhu.tscn b/entities/cthulhu.tscn index a80190b..b56b541 100644 --- a/entities/cthulhu.tscn +++ b/entities/cthulhu.tscn @@ -1,10 +1,12 @@ -[gd_scene load_steps=19 format=3 uid="uid://gl4umoff474y"] +[gd_scene load_steps=23 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"] [ext_resource type="Texture2D" uid="uid://17komk2y0f4e" path="res://entities/cthulhu_left.png" id="2_13vnj"] [ext_resource type="Texture2D" uid="uid://bs6es4d3fvunw" path="res://entities/cthulhu_right.png" id="4_1wxgg"] [ext_resource type="Texture2D" uid="uid://6revaeis55q1" path="res://entities/cthulhu_drag_left.png" id="5_6ho60"] +[ext_resource type="Texture2D" uid="uid://deqvgvf66grr4" path="res://entities/top_hat.png" id="5_a1p2d"] +[ext_resource type="Texture2D" uid="uid://d3tb6ypb36v8e" path="res://entities/monocle.png" id="6_04snb"] [ext_resource type="Texture2D" uid="uid://b0tlt1tgukajd" path="res://entities/cthulhu_drag_right.png" id="6_behik"] [ext_resource type="PackedScene" uid="uid://djcwis8ycrq85" path="res://behaviours/sampler_priority.tscn" id="6_truco"] [ext_resource type="PackedScene" uid="uid://rx24bppccih7" path="res://behaviours/move_physics.tscn" id="8_mvkr6"] @@ -12,6 +14,10 @@ [ext_resource type="PackedScene" uid="uid://dijcjahkddudv" path="res://behaviours/draggable.tscn" id="10_c36ur"] [ext_resource type="AudioStream" uid="uid://d0feiq5s6fnux" path="res://entities/imp_drag.wav" id="11_jt7u1"] [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"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_wjkbi"] +radius = 56.0 [sub_resource type="CircleShape2D" id="CircleShape2D_uw0y6"] radius = 50.0 @@ -200,6 +206,42 @@ texture = ExtResource("2_13vnj") left_texture = ExtResource("2_13vnj") right_texture = ExtResource("4_1wxgg") +[node name="TopHatter" parent="SpriteFocus/Sprite" instance=ExtResource("15_vopba")] +unique_name_in_owner = true +position = Vector2(0, -6) +scale = Vector2(0.5, 0.5) +acceptable_diets = Array[StringName]([&"TopHat"]) +target = 1 + +[node name="Sprite" type="Sprite2D" parent="SpriteFocus/Sprite/TopHatter"] +visible = false +z_index = 1 +position = Vector2(1, -54) +scale = Vector2(2, 2) +texture = ExtResource("5_a1p2d") + +[node name="Shape" type="CollisionShape2D" parent="SpriteFocus/Sprite/TopHatter"] +shape = SubResource("CircleShape2D_wjkbi") +debug_color = Color(1, 0, 0, 0) + +[node name="Monocler" parent="SpriteFocus/Sprite" instance=ExtResource("15_vopba")] +unique_name_in_owner = true +position = Vector2(0, -6) +scale = Vector2(0.5, 0.5) +acceptable_diets = Array[StringName]([&"Monocle"]) +target = 1 + +[node name="Sprite" type="Sprite2D" parent="SpriteFocus/Sprite/Monocler"] +visible = false +z_index = 1 +position = Vector2(10, -19) +scale = Vector2(2, 2) +texture = ExtResource("6_04snb") + +[node name="Shape" type="CollisionShape2D" parent="SpriteFocus/Sprite/Monocler"] +shape = SubResource("CircleShape2D_wjkbi") +debug_color = Color(1, 0, 0, 0) + [node name="Shape" type="CollisionShape2D" parent="."] position = Vector2(0, 36) shape = SubResource("CircleShape2D_uw0y6") @@ -237,6 +279,10 @@ bus = &"DragSounds" stream = ExtResource("12_v8da5") bus = &"FallSounds" +[connection signal="eaten" from="SpriteFocus/Sprite/TopHatter" to="." method="_on_eater_eaten"] +[connection signal="goal_reached" from="SpriteFocus/Sprite/TopHatter" to="SpriteFocus/Sprite/TopHatter/Sprite" method="show"] +[connection signal="eaten" from="SpriteFocus/Sprite/Monocler" to="." method="_on_eater_eaten"] +[connection signal="goal_reached" from="SpriteFocus/Sprite/Monocler" to="SpriteFocus/Sprite/Monocler/Sprite" method="show"] [connection signal="dragged" from="MovementDrag" to="." method="_on_dragged"] [connection signal="dragged" from="MovementDrag" to="MovementDrag/DragPriority" method="priority_alternative" unbinds=1] [connection signal="dragged" from="MovementDrag" to="MovementDrag/DragSound" method="play" unbinds=1] diff --git a/entities/imp.tscn b/entities/imp.tscn index b32576a..0379062 100644 --- a/entities/imp.tscn +++ b/entities/imp.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=32 format=3 uid="uid://4d3ksr3171x4"] +[gd_scene load_steps=35 format=3 uid="uid://4d3ksr3171x4"] [ext_resource type="Script" path="res://entities/imp.gd" id="1_dixpc"] [ext_resource type="PackedScene" uid="uid://bxbjfev0lhwws" path="res://behaviours/sprite_left_right.tscn" id="2_eqcdi"] @@ -6,8 +6,10 @@ [ext_resource type="Texture2D" uid="uid://bubehid53q8h1" path="res://entities/imp_right.png" id="4_0sckn"] [ext_resource type="PackedScene" uid="uid://tx1qi6ahlxjp" path="res://behaviours/spawner.tscn" id="4_d8lgm"] [ext_resource type="Texture2D" uid="uid://rxtd1rakhj" path="res://entities/imp_drag_left.png" id="5_fpj27"] +[ext_resource type="Texture2D" uid="uid://deqvgvf66grr4" path="res://entities/top_hat.png" id="5_w4u6a"] [ext_resource type="PackedScene" uid="uid://uoxwjpmgg27a" path="res://entities/gold.tscn" id="5_yrfoq"] [ext_resource type="Texture2D" uid="uid://dudq4p8owrpsa" path="res://entities/imp_drag_right.png" id="6_1cw6p"] +[ext_resource type="Texture2D" uid="uid://d3tb6ypb36v8e" path="res://entities/monocle.png" id="6_jebbv"] [ext_resource type="PackedScene" uid="uid://djcwis8ycrq85" path="res://behaviours/sampler_priority.tscn" id="7_ech8d"] [ext_resource type="PackedScene" uid="uid://ccul07w0h36nu" path="res://behaviours/sacrificable.tscn" id="7_gg20m"] [ext_resource type="PackedScene" uid="uid://dk1ipq7dhkhf3" path="res://behaviours/move_straight.tscn" id="8_ffcw0"] @@ -23,6 +25,9 @@ [ext_resource type="AudioStream" uid="uid://cwsg776c11xfc" path="res://entities/fall.ogg" id="17_lib0h"] [ext_resource type="AudioStream" uid="uid://c1yuksnjdd6g2" path="res://entities/imp_eat.ogg" id="19_7la6c"] +[sub_resource type="CircleShape2D" id="CircleShape2D_6l0s5"] +radius = 40.0 + [sub_resource type="CircleShape2D" id="CircleShape2D_ide4n"] radius = 32.0 @@ -239,6 +244,40 @@ texture = ExtResource("3_qda0k") left_texture = ExtResource("3_qda0k") right_texture = ExtResource("4_0sckn") +[node name="TopHatter" parent="Sprite" instance=ExtResource("14_w2h8x")] +unique_name_in_owner = true +scale = Vector2(0.5, 0.5) +acceptable_diets = Array[StringName]([&"TopHat"]) +target = 1 + +[node name="Sprite" type="Sprite2D" parent="Sprite/TopHatter"] +visible = false +z_index = 1 +position = Vector2(-1, -34) +scale = Vector2(2, 2) +texture = ExtResource("5_w4u6a") + +[node name="Shape" type="CollisionShape2D" parent="Sprite/TopHatter"] +shape = SubResource("CircleShape2D_6l0s5") +debug_color = Color(1, 0, 0, 0) + +[node name="Monocler" parent="Sprite" instance=ExtResource("14_w2h8x")] +unique_name_in_owner = true +scale = Vector2(0.5, 0.5) +acceptable_diets = Array[StringName]([&"Monocle"]) +target = 1 + +[node name="Sprite" type="Sprite2D" parent="Sprite/Monocler"] +visible = false +z_index = 1 +position = Vector2(7, -10) +scale = Vector2(2, 2) +texture = ExtResource("6_jebbv") + +[node name="Shape" type="CollisionShape2D" parent="Sprite/Monocler"] +shape = SubResource("CircleShape2D_6l0s5") +debug_color = Color(1, 0, 0, 0) + [node name="Shape" type="CollisionShape2D" parent="."] shape = SubResource("CircleShape2D_ide4n") @@ -348,6 +387,10 @@ debug_color = Color(1, 0, 0, 0) stream = ExtResource("19_7la6c") bus = &"KillSounds" +[connection signal="eaten" from="Sprite/TopHatter" to="." method="_on_eater_eaten"] +[connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sprite" method="show"] +[connection signal="eaten" from="Sprite/Monocler" to="." method="_on_eater_eaten"] +[connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sprite" method="show"] [connection signal="sacrificed" from="Sacrificable" to="." method="queue_free"] [connection signal="timeout" from="GoldSpawner/SpawnTimer" to="GoldSpawner" method="spawn"] [connection signal="changed_direction" from="MovementWander" to="MovementWander/WanderPriority" method="priority_conditional"] diff --git a/entities/monocle.tscn b/entities/monocle.tscn index ee45236..a014df4 100644 --- a/entities/monocle.tscn +++ b/entities/monocle.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=13 format=3 uid="uid://b04xhv32ypi42"] +[gd_scene load_steps=14 format=3 uid="uid://b04xhv32ypi42"] [ext_resource type="Script" path="res://entities/monocle.gd" id="1_ehpfj"] [ext_resource type="Texture2D" uid="uid://d3tb6ypb36v8e" path="res://entities/monocle.png" id="1_omrit"] [ext_resource type="PackedScene" uid="uid://rx24bppccih7" path="res://behaviours/move_physics.tscn" id="2_jgnsw"] +[ext_resource type="PackedScene" uid="uid://dfdr3e32lohq" path="res://behaviours/edible.tscn" id="3_7kfmh"] [ext_resource type="PackedScene" uid="uid://dijcjahkddudv" path="res://behaviours/draggable.tscn" id="3_e0ni5"] [ext_resource type="AudioStream" uid="uid://dgd1ldpffk6ql" path="res://entities/monocle_drag.wav" id="5_bs8m7"] [ext_resource type="AudioStream" uid="uid://cwsg776c11xfc" path="res://entities/fall.ogg" id="5_grwug"] @@ -127,6 +128,9 @@ libraries = { next/drag_loop = &"drag_loop" next/drag_start = &"drag_loop" +[node name="Edible" parent="." instance=ExtResource("3_7kfmh")] +diet = &"Monocle" + [node name="MovementDrag" parent="." instance=ExtResource("2_jgnsw")] [node name="Draggable" parent="MovementDrag" instance=ExtResource("3_e0ni5")] diff --git a/entities/sheep.gd b/entities/sheep.gd index 4db9776..c835a82 100644 --- a/entities/sheep.gd +++ b/entities/sheep.gd @@ -35,3 +35,6 @@ func _on_trapped() -> void: func _on_freed() -> void: z_index = Enums.ZIndex.EntityGround y_sort_enabled = true + +func _on_eater_eaten(edible: Edible) -> void: + edible.get_parent().queue_free() diff --git a/entities/sheep.tscn b/entities/sheep.tscn index 1c667a6..9819ef3 100644 --- a/entities/sheep.tscn +++ b/entities/sheep.tscn @@ -1,11 +1,13 @@ -[gd_scene load_steps=30 format=3 uid="uid://bc2bm8lbol18w"] +[gd_scene load_steps=34 format=3 uid="uid://bc2bm8lbol18w"] [ext_resource type="Script" path="res://entities/sheep.gd" id="1_4dmll"] [ext_resource type="Texture2D" uid="uid://iljp5yn3ehfk" path="res://entities/sheep_left.png" id="2_t13f5"] [ext_resource type="PackedScene" uid="uid://bxbjfev0lhwws" path="res://behaviours/sprite_left_right.tscn" id="2_xbkrm"] [ext_resource type="Texture2D" uid="uid://cxtmas4g0v6en" path="res://entities/sheep_right.png" id="4_5qoof"] +[ext_resource type="Texture2D" uid="uid://deqvgvf66grr4" path="res://entities/top_hat.png" id="5_gfn7a"] [ext_resource type="Texture2D" uid="uid://cfduc7cdorasr" path="res://entities/sheep_drag_left.png" id="5_gh6h6"] [ext_resource type="PackedScene" uid="uid://dfdr3e32lohq" path="res://behaviours/edible.tscn" id="6_3odsh"] +[ext_resource type="Texture2D" uid="uid://d3tb6ypb36v8e" path="res://entities/monocle.png" id="6_q0o52"] [ext_resource type="Texture2D" uid="uid://m5bebwb06kqe" path="res://entities/sheep_drag_right.png" id="6_x4fsj"] [ext_resource type="PackedScene" uid="uid://ccul07w0h36nu" path="res://behaviours/sacrificable.tscn" id="8_43m1b"] [ext_resource type="PackedScene" uid="uid://djcwis8ycrq85" path="res://behaviours/sampler_priority.tscn" id="9_s5lod"] @@ -21,6 +23,10 @@ [ext_resource type="PackedScene" uid="uid://ctpn4hvkhxoi3" path="res://behaviours/tracker_edible.tscn" id="16_6h84f"] [ext_resource type="AudioStream" uid="uid://bmfscpnugaejk" path="res://entities/sheep_drag.wav" id="16_nswfl"] [ext_resource type="AudioStream" uid="uid://cwsg776c11xfc" path="res://entities/fall.ogg" id="17_8kst2"] +[ext_resource type="PackedScene" uid="uid://jg7qkbswgqjc" path="res://behaviours/eater.tscn" id="22_lilpq"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_kq6qs"] +radius = 40.0 [sub_resource type="CircleShape2D" id="CircleShape2D_c5tcn"] radius = 24.0 @@ -214,6 +220,42 @@ texture = ExtResource("2_t13f5") left_texture = ExtResource("2_t13f5") right_texture = ExtResource("4_5qoof") +[node name="TopHatter" parent="Sprite" instance=ExtResource("22_lilpq")] +unique_name_in_owner = true +position = Vector2(0, 2) +scale = Vector2(0.5, 0.5) +acceptable_diets = Array[StringName]([&"TopHat"]) +target = 1 + +[node name="Sprite" type="Sprite2D" parent="Sprite/TopHatter"] +visible = false +z_index = 1 +position = Vector2(-10, -28) +scale = Vector2(2, 2) +texture = ExtResource("5_gfn7a") + +[node name="Shape" type="CollisionShape2D" parent="Sprite/TopHatter"] +shape = SubResource("CircleShape2D_kq6qs") +debug_color = Color(1, 0, 0, 0) + +[node name="Monocler" parent="Sprite" instance=ExtResource("22_lilpq")] +unique_name_in_owner = true +position = Vector2(0, 2) +scale = Vector2(0.5, 0.5) +acceptable_diets = Array[StringName]([&"Monocle"]) +target = 1 + +[node name="Sprite" type="Sprite2D" parent="Sprite/Monocler"] +visible = false +z_index = 1 +position = Vector2(-15, -5) +scale = Vector2(2, 2) +texture = ExtResource("6_q0o52") + +[node name="Shape" type="CollisionShape2D" parent="Sprite/Monocler"] +shape = SubResource("CircleShape2D_kq6qs") +debug_color = Color(1, 0, 0, 0) + [node name="Shape" type="CollisionShape2D" parent="."] shape = SubResource("CircleShape2D_c5tcn") @@ -329,6 +371,10 @@ bus = &"DragSounds" stream = ExtResource("17_8kst2") bus = &"FallSounds" +[connection signal="eaten" from="Sprite/TopHatter" to="." method="_on_eater_eaten"] +[connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sprite" method="show"] +[connection signal="eaten" from="Sprite/Monocler" to="." method="_on_eater_eaten"] +[connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sprite" method="show"] [connection signal="sacrificed" from="Sacrificable" to="." method="queue_free"] [connection signal="move" from="MovementIdle" to="." method="_on_move"] [connection signal="move_disabled" from="MovementIdle" to="MovementIdle/BoredTimer" method="stop"] diff --git a/entities/top_hat.tscn b/entities/top_hat.tscn index 97d18c4..e904197 100644 --- a/entities/top_hat.tscn +++ b/entities/top_hat.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=12 format=3 uid="uid://8ejgwtkpaa44"] +[gd_scene load_steps=13 format=3 uid="uid://8ejgwtkpaa44"] [ext_resource type="Script" path="res://entities/top_hat.gd" id="1_0eh11"] [ext_resource type="Texture2D" uid="uid://deqvgvf66grr4" path="res://entities/top_hat.png" id="1_gbqic"] +[ext_resource type="PackedScene" uid="uid://dfdr3e32lohq" path="res://behaviours/edible.tscn" id="3_6ru0l"] [ext_resource type="PackedScene" uid="uid://rx24bppccih7" path="res://behaviours/move_physics.tscn" id="3_gy414"] [ext_resource type="PackedScene" uid="uid://dijcjahkddudv" path="res://behaviours/draggable.tscn" id="4_fcvjo"] [ext_resource type="AudioStream" uid="uid://cwsg776c11xfc" path="res://entities/fall.ogg" id="6_6tpnh"] @@ -126,6 +127,9 @@ libraries = { next/drag_loop = &"drag_loop" next/drag_start = &"drag_loop" +[node name="Edible" parent="." instance=ExtResource("3_6ru0l")] +diet = &"TopHat" + [node name="MovementDrag" parent="." instance=ExtResource("3_gy414")] [node name="Draggable" parent="MovementDrag" instance=ExtResource("4_fcvjo")] diff --git a/entities/watcher.tscn b/entities/watcher.tscn index 11f7907..f3cd685 100644 --- a/entities/watcher.tscn +++ b/entities/watcher.tscn @@ -1,10 +1,12 @@ -[gd_scene load_steps=30 format=3 uid="uid://dnjtduk0hla3f"] +[gd_scene load_steps=33 format=3 uid="uid://dnjtduk0hla3f"] [ext_resource type="Script" path="res://entities/watcher.gd" id="1_brahc"] [ext_resource type="PackedScene" uid="uid://bxbjfev0lhwws" path="res://behaviours/sprite_left_right.tscn" id="1_thu73"] [ext_resource type="Texture2D" uid="uid://by6igmr52nlyi" path="res://entities/watcher_left.png" id="2_32yw7"] [ext_resource type="Texture2D" uid="uid://c6tbab5h4osj5" path="res://entities/watcher_right.png" id="3_k8fgk"] [ext_resource type="PackedScene" uid="uid://djcwis8ycrq85" path="res://behaviours/sampler_priority.tscn" id="4_i1htf"] +[ext_resource type="Texture2D" uid="uid://deqvgvf66grr4" path="res://entities/top_hat.png" id="5_axhwx"] +[ext_resource type="Texture2D" uid="uid://d3tb6ypb36v8e" path="res://entities/monocle.png" id="6_owihj"] [ext_resource type="Texture2D" uid="uid://dh61knesgvjs" path="res://entities/watcher_drag_left.png" id="7_ff3vx"] [ext_resource type="PackedScene" uid="uid://ccul07w0h36nu" path="res://behaviours/sacrificable.tscn" id="7_lxtqq"] [ext_resource type="Texture2D" uid="uid://b6uurud5clnqr" path="res://entities/watcher_drag_right.png" id="8_5nq2n"] @@ -21,6 +23,9 @@ [ext_resource type="PackedScene" uid="uid://jg7qkbswgqjc" path="res://behaviours/eater.tscn" id="19_ktenf"] [ext_resource type="AudioStream" uid="uid://c1yuksnjdd6g2" path="res://entities/imp_eat.ogg" id="20_bdcer"] +[sub_resource type="CircleShape2D" id="CircleShape2D_x5uuo"] +radius = 40.0 + [sub_resource type="CircleShape2D" id="CircleShape2D_diig7"] radius = 32.0 @@ -176,6 +181,40 @@ texture = ExtResource("2_32yw7") left_texture = ExtResource("2_32yw7") right_texture = ExtResource("3_k8fgk") +[node name="TopHatter" parent="Sprite" instance=ExtResource("19_ktenf")] +unique_name_in_owner = true +scale = Vector2(0.5, 0.5) +acceptable_diets = Array[StringName]([&"TopHat"]) +target = 1 + +[node name="Sprite" type="Sprite2D" parent="Sprite/TopHatter"] +visible = false +z_index = 1 +position = Vector2(-4, -29) +scale = Vector2(2, 2) +texture = ExtResource("5_axhwx") + +[node name="Shape" type="CollisionShape2D" parent="Sprite/TopHatter"] +shape = SubResource("CircleShape2D_x5uuo") +debug_color = Color(1, 0, 0, 0) + +[node name="Monocler" parent="Sprite" instance=ExtResource("19_ktenf")] +unique_name_in_owner = true +scale = Vector2(0.5, 0.5) +acceptable_diets = Array[StringName]([&"Monocle"]) +target = 1 + +[node name="Sprite" type="Sprite2D" parent="Sprite/Monocler"] +visible = false +z_index = 1 +position = Vector2(1, -4) +scale = Vector2(4.0012, 1.97504) +texture = ExtResource("6_owihj") + +[node name="Shape" type="CollisionShape2D" parent="Sprite/Monocler"] +shape = SubResource("CircleShape2D_x5uuo") +debug_color = Color(1, 0, 0, 0) + [node name="Shape" type="CollisionShape2D" parent="."] shape = SubResource("CircleShape2D_diig7") @@ -278,6 +317,10 @@ debug_color = Color(1, 0, 0, 0) stream = ExtResource("20_bdcer") bus = &"KillSounds" +[connection signal="eaten" from="Sprite/TopHatter" to="." method="_on_eater_eaten"] +[connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sprite" method="show"] +[connection signal="eaten" from="Sprite/Monocler" to="." method="_on_eater_eaten"] +[connection signal="goal_reached" from="Sprite/Monocler" to="Sprite/Monocler/Sprite" method="show"] [connection signal="sacrificed" from="Sacrificable" to="." method="queue_free"] [connection signal="move" from="MovementTilt" to="." method="_on_move"] [connection signal="ready" from="MovementTilt" to="MovementTilt" method="randomize_direction"]