@Megalomaniak said:
Hmm, maybe a check to see if an enemy was already spawned and if so then just pass?
i did
func _on_crown_area_entered(area):
if area.collision_layer==1:
var enemy = get_tree().root.find_node("enemy")
if enemy == null:
gui.reset_kills()
gui._spawn_enemies()
gui.plus_token()
gui.create_token()
self.queue_free()
but enemies spawn twice
could you say how to spawn
func _spawn_enemies():
enemy_pos.shuffle()
cannon_pos.shuffle()
for i in 5:
var scene = load("res://scenes/enemy.tscn")
var scene_instance = scene.instance()
get_tree().root.add_child(scene_instance)
scene_instance.position=enemy_pos[i-1]
for i in spawn_cannnons:
var scene = load("res://scenes/cannon.tscn")
var scene_instance = scene.instance()
get_tree().root.add_child(scene_instance)
scene_instance.position=cannon_pos[i-1]