From 034bdc6bd08e9b60931482c3a4968f53d7e5167f Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 15 Apr 2024 21:51:40 +0200 Subject: [PATCH] Make `Imp` spawn `Gold` periodically --- entities/imp.tscn | 8 ++++++++ scenes/game/main_game.tscn | 40 +------------------------------------- 2 files changed, 9 insertions(+), 39 deletions(-) diff --git a/entities/imp.tscn b/entities/imp.tscn index 6ec0350..fdacd18 100644 --- a/entities/imp.tscn +++ b/entities/imp.tscn @@ -43,6 +43,14 @@ tag = &"Sheep" [node name="SkullSpawner" parent="." instance=ExtResource("4_d8lgm")] scene = ExtResource("5_yrfoq") +[node name="Spawner" parent="." instance=ExtResource("4_d8lgm")] +scene = ExtResource("5_yrfoq") + +[node name="Timer" type="Timer" parent="Spawner"] +wait_time = 0.8 +autostart = true + [connection signal="move" from="Draggable" to="." method="_on_draggable_move"] [connection signal="eaten" from="EatTarget" to="." method="_on_eat_target_eaten"] [connection signal="move" from="EatTarget" to="." method="_on_move"] +[connection signal="timeout" from="Spawner/Timer" to="Spawner" method="spawn"] diff --git a/scenes/game/main_game.tscn b/scenes/game/main_game.tscn index 0491b05..2878937 100644 --- a/scenes/game/main_game.tscn +++ b/scenes/game/main_game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=16 format=3 uid="uid://cxj5aud02f40j"] +[gd_scene load_steps=14 format=3 uid="uid://cxj5aud02f40j"] [ext_resource type="Script" path="res://scenes/game/main_game.gd" id="1_wiglu"] [ext_resource type="PackedScene" path="res://behaviours/spawner.tscn" id="2_bx37o"] @@ -7,8 +7,6 @@ [ext_resource type="PackedScene" uid="uid://brvbtvt4em32" path="res://behaviours/counter.tscn" id="3_p6jw3"] [ext_resource type="PackedScene" uid="uid://eqb3vfbvjefp" path="res://entities/cloud.tscn" id="3_whlmm"] [ext_resource type="PackedScene" uid="uid://7j1b55t8tafg" path="res://scenes/game/cursor_magnet.tscn" id="3_xbolm"] -[ext_resource type="PackedScene" uid="uid://uoxwjpmgg27a" path="res://entities/gold.tscn" id="4_eu7q4"] -[ext_resource type="PackedScene" uid="uid://bc2bm8lbol18w" path="res://entities/sheep.tscn" id="5_63bwb"] [ext_resource type="Texture2D" uid="uid://dyvkvmw7wxwe5" path="res://icon.svg" id="9_8kxq4"] [ext_resource type="PackedScene" uid="uid://4d3ksr3171x4" path="res://entities/imp.tscn" id="10_26rf6"] @@ -846,44 +844,8 @@ debug_color = Color(1, 1, 1, 0) [node name="GoldCounter" parent="." instance=ExtResource("3_p6jw3")] -[node name="Gold" parent="." instance=ExtResource("4_eu7q4")] -position = Vector2(94, 70) - -[node name="Gold2" parent="." instance=ExtResource("4_eu7q4")] -position = Vector2(239, 96) - -[node name="Gold3" parent="." instance=ExtResource("4_eu7q4")] -position = Vector2(171, 199) - -[node name="Gold4" parent="." instance=ExtResource("4_eu7q4")] -position = Vector2(352, 196) - -[node name="Gold5" parent="." instance=ExtResource("4_eu7q4")] -position = Vector2(377, 96) - -[node name="Gold6" parent="." instance=ExtResource("4_eu7q4")] -position = Vector2(434, 188) - -[node name="Gold7" parent="." instance=ExtResource("4_eu7q4")] -position = Vector2(502, 104) - -[node name="Gold8" parent="." instance=ExtResource("4_eu7q4")] -position = Vector2(249, -51) - -[node name="Gold9" parent="." instance=ExtResource("4_eu7q4")] -position = Vector2(379, -58) - -[node name="Gold10" parent="." instance=ExtResource("4_eu7q4")] -position = Vector2(456, -7) - -[node name="Sheep" parent="." instance=ExtResource("5_63bwb")] -position = Vector2(-273, -86) - [node name="SpawnedEntities" type="Node2D" parent="."] -[node name="Cloud" parent="." instance=ExtResource("3_whlmm")] -position = Vector2(-62, -239) - [node name="Node2D" type="Node2D" parent="."] position = Vector2(590, 317) scale = Vector2(11.285, 11.285)