Trouble Creating and Randomizing Location of MovieClip
I am trying to make a game and I want to spawn 5 enemies when the game opens and place them in random places on the screen, but I can't figure it out.
The movieclip I am using is named Enemy and the linkage is named the exact same - Enemy
Here is what I have so far on the first frame::
var enemiesarray:Array;
enemiesarray = [];
function addEnemy():void
{
if(enemiesarray.length < 5)
{
var e:Enemy = new Enemy();
var startX:int = Math.random()*500-10; stage.stageWidth ;
var startY:int = Math.random()*500-10; stage.stageHeight ;
stage.addChild(e);
enemiesarray.push(e);
}
}
