Hello there. Im creating a first person shooter.
Im trying for 2-3 hours to add some enemys on the stage (from library) at certain seconds on a certain location).
With the following code i get no errors but the enemys wont spawn.
stop();
import flash.utils.Timer;
import flash.events.Event;
var enemy1Timer:Timer;
enemy1Timer=new Timer(1200, 1);
enemy1Timer.start();
var enemy1Array;
enemy1Array=new Array();
addEventListener(Event.ENTER_FRAME, enemy1spawn);
function enemy1spawn(event:Event):void
{
var Enemy1MC=MovieClip;
Enemy1MC=new Enemy1();
if(enemy1Timer.currentCount==1000)
{
Enemy1MC.x=400;
Enemy1MC.y=400;
addChild(Enemy1MC);
enemy1Array.push(Enemy1MC);
}
}
I also tried to spawn enemys without a timer and it worked but it spawns too many, so i think its a problem with the Timer.
Theres no enemy AS file, just the linkage, since i dont have what code to put in there. all the code will be on main timeline.
What could be the problem with my code?
Thanks in advance.