Hello there, I'm having a small problem with spawning enemies. I currently have a movieclip, called section1_mc. Within this movieclip I have another movieclip called spawn1_mc which moves up and down the screen.
I wish to spawn a third movieclip (enemyShip) along a random point of spawn1_mc's x axis.
The part of code which needs help on is shown below.
Code:
public function spawn(timer:TimerEvent):void {
var enemyShip:EnemyShip = new EnemyShip();
addChild(enemyShip);
var randomSeed:int = Math.random()*4 + 1;
trace ("enemyshiptimer");
if (randomSeed == 1) {
enemyShip.x = 400; //THE CODE IM GUESSING NEEDS TO CHANGE
enemyShip.y = 400;
trace ("random seed 1");
}
Thats the code I believe needs to be changed. I've attempted it myself but with no success :-( I'm fairly new to as3 but do I need to mess around the root function, and maybe bounding boxes? I'm not too sure as I mentioned but any help would be greatly appreciated! <3 x