use groups

This commit is contained in:
ajuvercr 2020-04-09 19:24:24 +02:00
parent aa768c6635
commit 9e47a2006f
3 changed files with 2 additions and 8 deletions

View file

@ -26,9 +26,7 @@ func build_tower():
last_built += tower_density
func build_all_towers():
while towers.size() > 0:
towers.pop_back().queue_free()
get_tree().call_group("tower", "queue_free")
last_built = 300
while last_built < screen_size.x * 3:
build_tower()
@ -44,5 +42,4 @@ func _ready():
randomize()
func _on_Tower_exit():
towers.pop_front()
build_tower()

View file

@ -5,6 +5,7 @@ signal passed
# Called when the node enters the scene tree for the first time.
func _ready():
add_to_group("tower")
pass # Replace with function body.
func _on_Tower_body_entered(body):

4
UI.gd
View file

@ -30,7 +30,3 @@ func _on_Player_passed():
func update_ui():
best_score.text = "Best: "+str(best)
current_score.text = "Current: "+str(current)
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass