Jump to content


Recommended Posts


I have a sprite loaded as atlasJSONArray.

I can create serveral versions of the animation and start playing it back like this:

for( var x = 0; x < 800; x = x+100){   for(var y = 0; y < 600; y = y+100){      var cat = game.add.sprite(x, y, 'cat');      cat.animations.add('run');                      cat.animations.play('run', 30, true);   }                 }

what Im trying to achive now is let every instance to start at a random frame (to make all animations look different).

i tried this but does not work:

cat.animations.frame = Math.floor(Math.random() * cat.animations.frameTotal);                

how could this be done?

I'm as3 coder so I used to do 


thks !




Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...