diff --git a/Camera2D.gd b/Camera2D.gd index b2748a9..93563e1 100644 --- a/Camera2D.gd +++ b/Camera2D.gd @@ -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() diff --git a/Tower.gd b/Tower.gd index 3f41ef7..cb49cc6 100644 --- a/Tower.gd +++ b/Tower.gd @@ -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): diff --git a/UI.gd b/UI.gd index afd5813..c793eaf 100644 --- a/UI.gd +++ b/UI.gd @@ -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