Hi guys,
im tryin to create very simple game. I want to spawn a line of enemies every N seconds. I created function to create enemies at random positions in a line (which seems to be working fine) and I want to repeat it (until the end of the game) every N seconds. But its not working.. My timer is:
Code:setInterval(createEnemies(), 200);
and my function:
Code:function createEnemies() { for (i = 0; i < enemiesInRow; i++) { var enemyObj = this.attachMovie("enemy", "enemy" + enemiesTotal, 10 + enemiesTotal); enemyObj._x = (500 / 15) * Math.round(Math.random() * 15); enemyObj._y = 250; enemiesTotal++; enemyArray.push(enemyObj); } }
its action script 2.0.
Is it possible that the timer is somehow interfering with the FOR cycle? Because when i use a bit more simple function it works..
Can somebody help me pleasethx


Reply With Quote


Bookmarks