Hi, I'm building a game, and using tweenmax as the enemies pathfinding (which works brilliant!)
Basically the enemy has a class attached to him, which, after he is spawned via code outside his class goes through and adds the tween, etc to him, BUT if I change that enemies frame in his own class the tween for some reasons stops after it moves to the first position... any clue why this would be? I can't figure it out for the life of me.
public function Enemy(code:int)
{
this.addEventListener(Event.ADDED, beginClass);
this.addEventListener(Event.ENTER_FRAME, eFrameEvents);
level = code;//set the level to the value passed in for use in other functions
}
private function beginClass(e:Event):void
{
_root = MovieClip(root);//defining the root
health = level * 5;
if (level == 1)
{
this.gotoAndStop(2); <--- THIS IS ISSUE: It changes his appearance all well and good, but seems to break the tween.
}
TweenMax.to(this, 20, {bezier:[{x:_root.wp2.x, y:_root.wp2.y}, {x:_root.wp2.x, y:_root.wp2.y}, {x:_root.wp3.x, y:_root.wp3.y}, {x:_root.wp4.x, y:_root.wp4.y}, {x:_root.wp5.x, y:_root.wp5.y}], orientToBezier:true});
}