Moved guests to own node

This commit is contained in:
Sammy 2021-06-12 15:03:50 +02:00
parent 7ef67351fb
commit 9306f1e18d
2 changed files with 15 additions and 11 deletions

View File

@ -1,6 +1,7 @@
extends Node2D
onready var streets = $Streets
onready var guests = $Guests
var Guest = load("res://Guest.tscn")
@ -22,4 +23,5 @@ func _on_GuestTimer_timeout():
print('new guest at: %s' % [guest_position])
var guest = Guest.instance();
guest.position = guest_position;
add_child(guest)
guests.add_child(guest)
print('Guest count: %s' % [guests.get_child_count()])

View File

@ -222,19 +222,21 @@ position = Vector2( 520.662, 230.739 )
[node name="DropOffPoint3" parent="." instance=ExtResource( 4 )]
position = Vector2( 166.312, 322.885 )
[node name="Guest" parent="." instance=ExtResource( 5 )]
position = Vector2( 337.119, 100.387 )
[node name="Guest2" parent="." instance=ExtResource( 5 )]
position = Vector2( 761.14, 102.634 )
[node name="Guest3" parent="." instance=ExtResource( 5 )]
position = Vector2( 758.143, 376.075 )
[node name="GuestTimer" type="Timer" parent="."]
wait_time = 5.0
autostart = true
script = ExtResource( 8 )
[connection signal="picked_up" from="Guest" to="." method="_on_Guest_picked_up"]
[node name="Guests" type="Node" parent="."]
[node name="Guest" parent="Guests" instance=ExtResource( 5 )]
position = Vector2( 337.119, 100.387 )
[node name="Guest2" parent="Guests" instance=ExtResource( 5 )]
position = Vector2( 761.14, 102.634 )
[node name="Guest3" parent="Guests" instance=ExtResource( 5 )]
position = Vector2( 758.143, 376.075 )
[connection signal="timeout" from="GuestTimer" to="." method="_on_GuestTimer_timeout"]
[connection signal="picked_up" from="Guests/Guest" to="." method="_on_Guest_picked_up"]