dsgsgsg
Members-
Posts
7 -
Joined
-
Last visited
dsgsgsg's Achievements
0
Reputation
-
I dont think the timeline was being append muultiple times because i used a trace to check that. And the good thing I solved the issue although I dont know how I did it. What I did was this: 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){ var tempCont:Sprite=new Sprite(); this.addChild(tempCont); _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 ); } See I placed the creation of tempCont where _leaderEnemy was being created, now it is working properly. But could you tell me why that was an issue, I mean either way a new tempCont should be created every time the function is called.
-
I did as you said: public function createEnemies(enemyNo:int, path:Array, dir:String,offset:int, duration:int, delay:int):void { g++; var tempCont:Sprite=new Sprite(); this.addChild(tempCont); tempCont.name="temp"+g; 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 ); } it does not really change the result. I was looking into naming each tempCont with a different suffix in order to insure that I am adding each group to diff tempCont.
-
Actually what I want is every time I make a function call, the enemyCont to animate which in turn also animates the _shooter and _leaderEnemy inside it. Why I want to do that is because of this: http://forums.greensock.com/topic/7485-offset-tween-path/ Hope that makes sense...........
-
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.
-
Thanks for the info. The code I am using is: var path01:Array= new Array({x:200, y:350}, {x:100, y:200}); myTween=TweenMax.to(_shooterEnemy, 10, {bezier:path01}); I want 5 other mc's to follow the same path but at a distance from each other. you can see an example with the pic I attached on the first post. Any ideas?
-
I want to tween various movieclips over the same path. My problem is I want them to be offset so that they follow the same path but still are at a distance from each other. I searched the forums but couldn't find any offset path property. Anything you can suggest?