use groups
This commit is contained in:
parent
aa768c6635
commit
9e47a2006f
3 changed files with 2 additions and 8 deletions
|
@ -26,9 +26,7 @@ func build_tower():
|
||||||
last_built += tower_density
|
last_built += tower_density
|
||||||
|
|
||||||
func build_all_towers():
|
func build_all_towers():
|
||||||
while towers.size() > 0:
|
get_tree().call_group("tower", "queue_free")
|
||||||
towers.pop_back().queue_free()
|
|
||||||
|
|
||||||
last_built = 300
|
last_built = 300
|
||||||
while last_built < screen_size.x * 3:
|
while last_built < screen_size.x * 3:
|
||||||
build_tower()
|
build_tower()
|
||||||
|
@ -44,5 +42,4 @@ func _ready():
|
||||||
randomize()
|
randomize()
|
||||||
|
|
||||||
func _on_Tower_exit():
|
func _on_Tower_exit():
|
||||||
towers.pop_front()
|
|
||||||
build_tower()
|
build_tower()
|
||||||
|
|
1
Tower.gd
1
Tower.gd
|
@ -5,6 +5,7 @@ signal passed
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
|
add_to_group("tower")
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
func _on_Tower_body_entered(body):
|
func _on_Tower_body_entered(body):
|
||||||
|
|
4
UI.gd
4
UI.gd
|
@ -30,7 +30,3 @@ func _on_Player_passed():
|
||||||
func update_ui():
|
func update_ui():
|
||||||
best_score.text = "Best: "+str(best)
|
best_score.text = "Best: "+str(best)
|
||||||
current_score.text = "Current: "+str(current)
|
current_score.text = "Current: "+str(current)
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
#func _process(delta):
|
|
||||||
# pass
|
|
||||||
|
|
Loading…
Reference in a new issue