1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-25 00:54:19 +00:00

implemented logic for manual and automatic spawner

This commit is contained in:
Matteo Balugani 2023-10-01 00:25:13 +02:00
parent 4e90184a2e
commit be64f3d8d7
4 changed files with 14 additions and 8 deletions

View file

@ -5,7 +5,7 @@
[ext_resource type="Texture2D" uid="uid://2vtvoj6ua3cb" path="res://entity/coin_copper_outline_2.png" id="2_2ifq3"] [ext_resource type="Texture2D" uid="uid://2vtvoj6ua3cb" path="res://entity/coin_copper_outline_2.png" id="2_2ifq3"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_c6byl"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_c6byl"]
size = Vector2(16, 5) size = Vector2(14, 3)
[node name="CoinCopper" type="RigidBody2D"] [node name="CoinCopper" type="RigidBody2D"]
collision_layer = 5 collision_layer = 5

View file

@ -79,6 +79,17 @@ texture_filter = 1
[node name="GravityFromGyro" parent="UI/GameContainer/Game/Bottle" instance=ExtResource("2_m7p4p")] [node name="GravityFromGyro" parent="UI/GameContainer/Game/Bottle" instance=ExtResource("2_m7p4p")]
[node name="Spawner" parent="UI/GameContainer/Game" instance=ExtResource("3_pubxn")] [node name="Spawner" parent="UI/GameContainer/Game" instance=ExtResource("3_pubxn")]
position = Vector2(0, -400) position = Vector2(-24, -407)
scene = ExtResource("2_dv01l") scene = ExtResource("2_dv01l")
target_parent = NodePath("..") target_parent = NodePath("..")
[node name="Timer2" type="Timer" parent="UI/GameContainer/Game/Spawner"]
autostart = true
[node name="TouchSpawner" parent="UI/GameContainer/Game" instance=ExtResource("3_pubxn")]
position = Vector2(23, -424)
scene = ExtResource("2_dv01l")
target_parent = NodePath("..")
[connection signal="pressed" from="UI/Rows/UpperButtons/SpawnButton" to="UI/GameContainer/Game/TouchSpawner" method="spawn"]
[connection signal="timeout" from="UI/GameContainer/Game/Spawner/Timer2" to="UI/GameContainer/Game/Spawner" method="spawn"]

View file

@ -9,3 +9,4 @@ func spawn():
var scene_instant = scene.instantiate() var scene_instant = scene.instantiate()
scene_instant.position=Vector2.ZERO scene_instant.position=Vector2.ZERO
add_child(scene_instant) add_child(scene_instant)

View file

@ -8,15 +8,9 @@ size = Vector2(16, 5)
[node name="Spawner" type="Node2D"] [node name="Spawner" type="Node2D"]
script = ExtResource("1_xqfmg") script = ExtResource("1_xqfmg")
[node name="Timer" type="Timer" parent="."]
wait_time = 0.1
autostart = true
[node name="Area" type="Area2D" parent="."] [node name="Area" type="Area2D" parent="."]
collision_mask = 4 collision_mask = 4
[node name="CoinShape" type="CollisionShape2D" parent="Area"] [node name="CoinShape" type="CollisionShape2D" parent="Area"]
scale = Vector2(3, 3) scale = Vector2(3, 3)
shape = SubResource("RectangleShape2D_p13i4") shape = SubResource("RectangleShape2D_p13i4")
[connection signal="timeout" from="Timer" to="." method="spawn"]