From ad6683aaf11fc5114f75d0cc8afb941df2f30e43 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 29 Apr 2024 02:53:09 +0200 Subject: [PATCH] Make more entities sacrificable Recipes should be tweaked --- entities/chupacabra.tscn | 38 ++++++++++++++++++++- entities/summoning_circle_pentagram.tscn | 20 ++++++++++- entities/watcher.tscn | 42 ++++++++++++++++++++++-- 3 files changed, 95 insertions(+), 5 deletions(-) diff --git a/entities/chupacabra.tscn b/entities/chupacabra.tscn index 876c1a3..ee9e773 100644 --- a/entities/chupacabra.tscn +++ b/entities/chupacabra.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=28 format=3 uid="uid://cmemgijh6nfmk"] +[gd_scene load_steps=33 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"] @@ -7,14 +7,18 @@ [ext_resource type="Texture2D" uid="uid://bpg0do7wlvqdj" path="res://entities/chupacabra_drag_left.png" id="5_hxrq2"] [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"] [ext_resource type="PackedScene" uid="uid://djcwis8ycrq85" path="res://behaviours/sampler_priority.tscn" id="7_nq78n"] [ext_resource type="PackedScene" uid="uid://dk1ipq7dhkhf3" path="res://behaviours/move_straight.tscn" id="8_7fxrt"] [ext_resource type="PackedScene" uid="uid://cm67ko1k6kn4u" path="res://behaviours/priority.tscn" id="9_7i81t"] [ext_resource type="PackedScene" uid="uid://cbg5kgwxusvxf" path="res://behaviours/cursor_detector.tscn" id="10_3wu3x"] [ext_resource type="PackedScene" uid="uid://rx24bppccih7" path="res://behaviours/move_physics.tscn" id="12_oildi"] +[ext_resource type="PackedScene" uid="uid://cml7rqvyfuagx" path="res://behaviours/move_towards.tscn" id="13_vh42q"] [ext_resource type="PackedScene" uid="uid://dijcjahkddudv" path="res://behaviours/draggable.tscn" id="13_wcydr"] +[ext_resource type="PackedScene" uid="uid://ctpn4hvkhxoi3" path="res://behaviours/tracker_edible.tscn" id="14_mk76g"] [ext_resource type="AudioStream" uid="uid://d0feiq5s6fnux" path="res://entities/imp_drag.wav" id="14_u2uf4"] [ext_resource type="AudioStream" uid="uid://cwsg776c11xfc" path="res://entities/fall.ogg" id="15_q7bw3"] +[ext_resource type="PackedScene" uid="uid://dti7l0d40hhgt" path="res://behaviours/target_picker.tscn" id="15_xay6p"] [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"] @@ -341,6 +345,9 @@ _data = { [sub_resource type="CircleShape2D" id="CircleShape2D_dcrcb"] radius = 48.0 +[sub_resource type="CircleShape2D" id="CircleShape2D_kjhx2"] +radius = 25.19 + [sub_resource type="CircleShape2D" id="CircleShape2D_vm5g3"] radius = 32.0 @@ -374,6 +381,9 @@ next/drag_start = &"drag_loop" next/run = &"run" next/sit = &"sit" +[node name="Sacrificable" parent="." instance=ExtResource("7_igror")] +kind = &"Chupacabra" + [node name="MovementSampler" parent="." instance=ExtResource("7_nq78n")] [node name="MovementWander" parent="." instance=ExtResource("8_7fxrt")] @@ -421,6 +431,24 @@ deviation = 0.2 min_secs = 0.1 max_secs = 0.3 +[node name="MovementTrap" parent="." instance=ExtResource("13_vh42q")] +speed = 600.0 +enabled = false + +[node name="TrapPriority" parent="MovementTrap" instance=ExtResource("9_7i81t")] +alternative_priority = 45 + +[node name="TrackerTrap" parent="MovementTrap" instance=ExtResource("14_mk76g")] +collision_mask = 8 +acceptable_diets = Array[StringName]([&"Trap"]) + +[node name="Shape" type="CollisionShape2D" parent="MovementTrap/TrackerTrap"] +shape = SubResource("CircleShape2D_kjhx2") +debug_color = Color(1, 0.498039, 0, 0) + +[node name="TargetPicker" parent="MovementTrap/TrackerTrap" node_paths=PackedStringArray("tracker") instance=ExtResource("15_xay6p")] +tracker = NodePath("..") + [node name="MovementDrag" parent="." instance=ExtResource("12_oildi")] enabled = false @@ -468,6 +496,14 @@ stream = ExtResource("17_ccla5") [connection signal="move" from="MovementSkitter" to="." method="_on_move"] [connection signal="cursor_entered" from="MovementSkitter/CursorSense" to="." method="_on_cursor_detected"] [connection signal="timeout" from="MovementSkitter/CalmTimer" to="MovementSkitter" method="clear_direction"] +[connection signal="changed_target" from="MovementTrap" to="MovementTrap/TrapPriority" method="priority_conditional"] +[connection signal="move" from="MovementTrap" to="." method="_on_move"] +[connection signal="area_entered" from="MovementTrap/TrackerTrap" to="MovementTrap/TrackerTrap" method="check_diet_then_track"] +[connection signal="area_exited" from="MovementTrap/TrackerTrap" to="MovementTrap/TrackerTrap" method="untrack"] +[connection signal="tracked" from="MovementTrap/TrackerTrap" to="MovementTrap/TrackerTrap/TargetPicker" method="sample_target_if_null" unbinds=1] +[connection signal="untracked" from="MovementTrap/TrackerTrap" to="MovementTrap/TrackerTrap/TargetPicker" method="clear_if_target"] +[connection signal="target_changed" from="MovementTrap/TrackerTrap/TargetPicker" to="MovementTrap" method="set_target" unbinds=1] +[connection signal="target_changed" from="MovementTrap/TrackerTrap/TargetPicker" to="MovementTrap/TrackerTrap/TargetPicker" method="sample_target_if_null" unbinds=2] [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/summoning_circle_pentagram.tscn b/entities/summoning_circle_pentagram.tscn index 5d15db8..d032aaf 100644 --- a/entities/summoning_circle_pentagram.tscn +++ b/entities/summoning_circle_pentagram.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=3 uid="uid://cgpwig0rd08vh"] +[gd_scene load_steps=10 format=3 uid="uid://cgpwig0rd08vh"] [ext_resource type="Script" path="res://behaviours/summoning_circle.gd" id="1_l5mec"] [ext_resource type="PackedScene" uid="uid://tx1qi6ahlxjp" path="res://behaviours/spawner.tscn" id="2_xq0wr"] @@ -7,6 +7,8 @@ [ext_resource type="PackedScene" uid="uid://ufjnfj3itypj" path="res://behaviours/summoning_recipe.tscn" id="5_jbk35"] [ext_resource type="PackedScene" uid="uid://4d3ksr3171x4" path="res://entities/imp.tscn" id="6_utwxo"] [ext_resource type="PackedScene" uid="uid://cmemgijh6nfmk" path="res://entities/chupacabra.tscn" id="7_a2sha"] +[ext_resource type="PackedScene" uid="uid://dnjtduk0hla3f" path="res://entities/watcher.tscn" id="8_jtxan"] +[ext_resource type="PackedScene" uid="uid://gl4umoff474y" path="res://entities/cthulhu.tscn" id="9_wli14"] [node name="SummoningCirclePentagram" type="Node2D"] script = ExtResource("1_l5mec") @@ -43,6 +45,14 @@ ingredients = Array[StringName]([&"Sheep", &"Sheep", &"Sheep", &"Sheep", &"Sheep mode = 2 ingredients = Array[StringName]([&"Imp", &"Imp", &"Imp", &"Imp", &"Imp"]) +[node name="FiveChupacabras" parent="Recipes" instance=ExtResource("5_jbk35")] +mode = 2 +ingredients = Array[StringName]([&"Chupacabra", &"Chupacabra", &"Chupacabra", &"Chupacabra", &"Chupacabra"]) + +[node name="FiveWatchers" parent="Recipes" instance=ExtResource("5_jbk35")] +mode = 2 +ingredients = Array[StringName]([&"Watcher", &"Watcher", &"Watcher", &"Watcher", &"Watcher"]) + [node name="Spawners" type="Node2D" parent="."] [node name="Imp" parent="Spawners" instance=ExtResource("2_xq0wr")] @@ -51,5 +61,13 @@ scene = ExtResource("6_utwxo") [node name="Chupacabra" parent="Spawners" instance=ExtResource("2_xq0wr")] scene = ExtResource("7_a2sha") +[node name="Watcher" parent="Spawners" instance=ExtResource("2_xq0wr")] +scene = ExtResource("8_jtxan") + +[node name="Cthulhu" parent="Spawners" instance=ExtResource("2_xq0wr")] +scene = ExtResource("9_wli14") + [connection signal="matched" from="Recipes/FiveSheep" to="Spawners/Imp" method="spawn" unbinds=1] [connection signal="matched" from="Recipes/FiveImps" to="Spawners/Chupacabra" method="spawn" unbinds=1] +[connection signal="matched" from="Recipes/FiveChupacabras" to="Spawners/Watcher" method="spawn" unbinds=1] +[connection signal="matched" from="Recipes/FiveWatchers" to="Spawners/Watcher" method="spawn" unbinds=1] diff --git a/entities/watcher.tscn b/entities/watcher.tscn index 5fa7b11..e5c8ca8 100644 --- a/entities/watcher.tscn +++ b/entities/watcher.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=19 format=3 uid="uid://dnjtduk0hla3f"] +[gd_scene load_steps=24 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"] @@ -6,12 +6,16 @@ [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://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"] [ext_resource type="PackedScene" uid="uid://rx24bppccih7" path="res://behaviours/move_physics.tscn" id="8_jy8ay"] [ext_resource type="PackedScene" uid="uid://cm67ko1k6kn4u" path="res://behaviours/priority.tscn" id="9_wtsor"] [ext_resource type="PackedScene" uid="uid://dijcjahkddudv" path="res://behaviours/draggable.tscn" id="10_qbgiu"] [ext_resource type="AudioStream" uid="uid://d0feiq5s6fnux" path="res://entities/imp_drag.wav" id="11_rydo5"] [ext_resource type="AudioStream" uid="uid://cwsg776c11xfc" path="res://entities/fall.ogg" id="12_0h21e"] +[ext_resource type="PackedScene" uid="uid://cml7rqvyfuagx" path="res://behaviours/move_towards.tscn" id="14_qtr50"] +[ext_resource type="PackedScene" uid="uid://ctpn4hvkhxoi3" path="res://behaviours/tracker_edible.tscn" id="15_ihnef"] +[ext_resource type="PackedScene" uid="uid://dti7l0d40hhgt" path="res://behaviours/target_picker.tscn" id="16_ch04y"] [sub_resource type="CircleShape2D" id="CircleShape2D_diig7"] radius = 32.0 @@ -121,7 +125,7 @@ tracks/1/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), "update": 1, -"values": [ExtResource("2_32yw7")] +"values": [ExtResource("7_ff3vx")] } tracks/2/type = "value" tracks/2/imported = false @@ -133,7 +137,7 @@ tracks/2/keys = { "times": PackedFloat32Array(0), "transitions": PackedFloat32Array(1), "update": 1, -"values": [ExtResource("3_k8fgk")] +"values": [ExtResource("8_5nq2n")] } [sub_resource type="AnimationLibrary" id="AnimationLibrary_yam4u"] @@ -143,6 +147,9 @@ _data = { "drag_start": SubResource("Animation_2igbw") } +[sub_resource type="CircleShape2D" id="CircleShape2D_a0gfn"] +radius = 25.19 + [sub_resource type="CircleShape2D" id="CircleShape2D_ywwo3"] radius = 32.0 @@ -169,8 +176,29 @@ libraries = { next/drag_loop = &"drag_loop" next/drag_start = &"drag_loop" +[node name="Sacrificable" parent="." instance=ExtResource("7_lxtqq")] +kind = &"Watcher" + [node name="MovementSampler" parent="." instance=ExtResource("4_i1htf")] +[node name="MovementTrap" parent="." instance=ExtResource("14_qtr50")] +speed = 600.0 +enabled = false + +[node name="TrapPriority" parent="MovementTrap" instance=ExtResource("9_wtsor")] +alternative_priority = 45 + +[node name="TrackerTrap" parent="MovementTrap" instance=ExtResource("15_ihnef")] +collision_mask = 8 +acceptable_diets = Array[StringName]([&"Trap"]) + +[node name="Shape" type="CollisionShape2D" parent="MovementTrap/TrackerTrap"] +shape = SubResource("CircleShape2D_a0gfn") +debug_color = Color(1, 0.498039, 0, 0) + +[node name="TargetPicker" parent="MovementTrap/TrackerTrap" node_paths=PackedStringArray("tracker") instance=ExtResource("16_ch04y")] +tracker = NodePath("..") + [node name="MovementDrag" parent="." instance=ExtResource("8_jy8ay")] position = Vector2(1, 0) enabled = false @@ -190,6 +218,14 @@ stream = ExtResource("11_rydo5") [node name="FallSound" type="AudioStreamPlayer2D" parent="MovementDrag"] stream = ExtResource("12_0h21e") +[connection signal="changed_target" from="MovementTrap" to="MovementTrap/TrapPriority" method="priority_conditional"] +[connection signal="move" from="MovementTrap" to="." method="_on_move"] +[connection signal="area_entered" from="MovementTrap/TrackerTrap" to="MovementTrap/TrackerTrap" method="check_diet_then_track"] +[connection signal="area_exited" from="MovementTrap/TrackerTrap" to="MovementTrap/TrackerTrap" method="untrack"] +[connection signal="tracked" from="MovementTrap/TrackerTrap" to="MovementTrap/TrackerTrap/TargetPicker" method="sample_target_if_null" unbinds=1] +[connection signal="untracked" from="MovementTrap/TrackerTrap" to="MovementTrap/TrackerTrap/TargetPicker" method="clear_if_target"] +[connection signal="target_changed" from="MovementTrap/TrackerTrap/TargetPicker" to="MovementTrap" method="set_target" unbinds=1] +[connection signal="target_changed" from="MovementTrap/TrackerTrap/TargetPicker" to="MovementTrap/TrackerTrap/TargetPicker" method="sample_target_if_null" unbinds=2] [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]