minasokoni Posted August 11, 2015 Share Posted August 11, 2015 I have a group of sprites that are all the same in a loop. What would be the best way to offset each animation frame, so they all don't animate at the same frame. Link to comment Share on other sites More sharing options...
tips4design Posted August 11, 2015 Share Posted August 11, 2015 How do you animate them? Tweens? Spritesheet animations? When do you start the animation? Link to comment Share on other sites More sharing options...
minasokoni Posted August 12, 2015 Author Share Posted August 12, 2015 Sorry I figured it out. this is what I did: for (var i = 0; i < skullPos.length; i++) { for (var j = 0; j < skullPos[i].length; j++) { if (skullPos[i][j] == 1) { var skull = this.skulls.create(0, 0, '01_skull_red'); skull.x = j * (skull.width + (skull.width / 2)); skull.y = i * (skull.height + (skull.height / 2)); skull.animations.add('talk'); skull.animations.play('talk', 60, true); skull.animations.next(Math.floor(Math.random() * 10) + 1); this.game.physics.arcade.enable(this.skulls); this.skulls.enableBody = true; skull.body.immovable = true; } } } Link to comment Share on other sites More sharing options...
Recommended Posts