i'm trying to have my button come at you so if it reaches you it hurts you. i have to use a child because i need the enemy to be randomly generated. what i'm having a problem with is actually getting the child of the button to move.
here's all my code for it. if you could help me it'd be greatly appreciated :)
var showMcNum:Number = 0;
var movieList:Array = [airball,fireball,rockball,waterball];
var spareList:Array = [airball,fireball,rockball,waterball];
function getRandomMovie():SimpleButton {
if(!movieList.length) {
movieList = spareList;
spareList = [];
}
return new movieList[Math.floor(Math.random()*movieList.length)];
}
var mc:SimpleButton;
this.addEventListener(Event.ENTER_FRAME,enemy);
function enemy(event:Event):void{
if (showMcNum < 100){
if (mc && mc.parent){
removeChild(mc);
}
mc = getRandomMovie();
addChild(mc);
mc.x = 320;
mc.y = 50;
showMcNum++;
}
}
moving the child of a button
Friday, June 1, 2012
[Action Script] moving the child of a button June,2012
Posted by Bimo Hery Prabowo at 7:13 PM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment