"multiply frog enemy" timer and array AS3

Posted by VideoDnd on Stack Overflow See other posts from Stack Overflow or by VideoDnd
Published on 2010-03-04T18:44:29Z Indexed on 2010/06/03 12:14 UTC
Read the original article Hit count: 351

Filed under:
|

How can I use the counter value to multiply the frogs in the array? My counter goes from 0-100. I want to prove that I can increment the enemies using a counter.

EXPLAINED BETTER
I have 10 frogs in an array. I want to use a timer to add 10 more frogs on each iteration of the TimerEvent.TIMER firing.

alt text

//currentCount
var timer:Timer = new Timer(1000, 50);
timer.addEventListener(TimerEvent.TIMER, countdown);
timer.start();
function countdown(event:TimerEvent) {
//    myText.text = String(0 + timer.currentCount);
}



//Creates 10 enemies "I want enemies to multiply 0-100"
var enemyArray:Array = new Array();
for (var i:int = 0; i < 10; i++)
{
   var noname:FrogClass = new FrogClass();
   noname.x = i*10; //this will just assign some different x and y value depending on i.
   noname.y = i*11;
   enemyArray.push(noname); //put the enemy into the array
   addChild(noname); //puts it on the stage
}

alt text

SYMBOL PROPERTIES
NAME "noname"
CLASS "FrogClass"

WHY
I need specific examples using strings and arrays, because I'm stuck in a learning curve.
Stupid examples are more fun!

© Stack Overflow or respective owner

Related posts about flash

Related posts about actionscript-3