Copy link to clipboard
Copied
I have the enemies appearing on my stage and spawning accordingly. I have the location on where I want them to spawn. The problem is that they are spawning on the first frame of my game which is the main menu before entering the actual playing field. Not the second frame where my game commences.
How can i go about this?
I tried this command and it just starts the game on the second frame.
I wrote this code within my createEnemy function.
createEnemy.start(2);
function commenceGame():void
{
//Sliding Duck Objects
enemy = 1000;
enemyTimer = new Timer(1000, enemy);
enemyStorage = new MovieClip();
addChild(enemyStorage);
enemyTimer.addEventListener(TimerEvent.TIMER,createEnemy);
enemyTimer.start();
cursor = new Cursor();
addChild(cursor);
cursor.enabled=true;
Mouse.hide();
stage.addEventListener(MouseEvent.MOUSE_MOVE,shiftCursor);
}
//Creates Enemies on the Stage
function createEnemy(event:TimerEvent):void
{
var enemyAppear = new MovieClip;
enemyAppear = new Enemy();
enemyAppear.x = 245;
enemyAppear.y = 285;
enemyStorage.addChild(enemyAppear);
}
commenceGame();
Hope this is enough code of my game to determine how to go about what I request.
Thanks Casey
1 Correct answer
If you don't want the enemiies to be generated until you are in frame 2, then put the enemy generating code in frame 2.
Copy link to clipboard
Copied
If you don't want the enemiies to be generated until you are in frame 2, then put the enemy generating code in frame 2.
Copy link to clipboard
Copied
Cool thanks that works perfectly appreciate it!

