Advertisement
Guest User

Untitled

a guest
Aug 13th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haxe 0.65 KB | None | 0 0
  1. public function changeAnimation(animationName:String)
  2.     {
  3.         if (currentAnimation != animationName)
  4.         {
  5.             currentAnimation = animationName;
  6.             //attachImageToActor(framesImage[0][index], actor, 0, 0);
  7.             var array = animationFrames.get(animationName);
  8.             //trace (array.length);
  9.             if (array.length > 0)
  10.             {
  11.                 attachImageToActor(array[0], actor, 0, 0);
  12.                 var index = 0;
  13.                 runPeriodically(100 * frameTime, function(timeTask:TimedTask):Void
  14.                 {
  15.                     if (index >= array.length)
  16.                         index = 0;
  17.                     attachImageToActor(array[index++], actor, 0, 0);   
  18.                 }, actor);
  19.             }
  20.             else
  21.                 attachImageToActor(array[0], actor, 0, 0);
  22.         }
  23.        
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement