I am turning this over to you because my brain is about to melt.
For some reason, the following for loop only runs twice despite there being 3 items in the array it is iterating over. No change if I increase the size of the array (
enemies_stack). I know the
break statement is not being run because a
print() put before it does not output anything.
var ENEMY = preload(....tscn)
var num_active_enemies = 0
enemies_stack = [3,3,3]
for enemy in enemies_stack:
if num_active_enemies >= 10:
var enemy_instance = ENEMY.instance()
enemy_instance.global_position = random_spawn_loc(enemy)
num_active_enemies += 1
HERE is the GitHub link with the full script and project files. Please help me lol.