Jump to content
Search Community

johnjoallen

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by johnjoallen

  1. Hi Guys,

     

    I'm wondering can you give me a little help. I'm using TimelineMax within and for loop and the animations are being messed around... basically it looks like everything is being scarmbled

     

    CODE:

    for(var i:uint = 0; i < attackEnemiesToAnimate.length; i++)
    {	
    	enemyToTrack = attackEnemiesToAnimate[i];
            createAnimation(enemyToTrack);	
    			
    	if(enemyToTrack.x == stage.stageWidth - 20)
    	{
    		attackEnemiesToAnimate.splice(i,1);
    		this.removeChild(enemyToTrack);
    		enemyToTrack = null;
    	}
    enemyToTrack = null;
    }
    
    private function createAnimation(e:Enemy):void
    {	
        var tl:TimelineMax = new TimelineMax();
       tl.to(e, 0.5, {x:stage.stageWidth - 100, y:50},1).to(e, 0.5, {x:pirate.x, y:pirate.y},2).to(e, 0.5,  {x:-stage.stageWidth - 30, y:-stage.stageHeight - 10}, 3);
      e = null;
    tl =null;
    }
    

    Any Suggestions

     

    Cheers,

     

    John

×
×
  • Create New...