Hello, I have a loop in which I am placing an enemy leader, (the first enemy) and the rest that have position relative to the enemy leader.They all animate over a path. The Call:
createEnemies(2,path02,100, 5,0);
createEnemies(3,path02,100, 5,0);
The Function:
public function createEnemies(enemyNo:int, path:Array, dir:String,offset:int, duration:int, delay:int):void
{
for(var i:uint=1;i<=enemyNo;i++){
if (i==1){
_leaderEnemy = new ShooterEnemy();
_leaderEnemy.x=0;
_leaderEnemy.y=0;
_leaderEnemy.count=enemyNo;
_leaderEnemy.name = "_shooterEnemy"+i;
leaderEnemyArray.push(_leaderEnemy);
tempCont.addChild(_leaderEnemy);
}
else
{
var _shooterEnemy:ShooterEnemy = new ShooterEnemy();
_shooterEnemy.x=0;
_shooterEnemy.y=(offset*(i-1));
_shooterEnemy.name = "_shooterEnemy"+i;
tempCont.addChild(_shooterEnemy)}
}
timeline.append(TweenMax.to(tempCont, duration, {bezier:path,orientToBezier:false, ease:Linear.easeNone}),delay );
}
Every time I call the three or four times, all the enemies animate at once. But what I want is the group of enemies moving in their order. i.e. one after another I am new to timeline and tween max library so any help would be nice.