giorg Posted December 3, 2018 Share Posted December 3, 2018 Hello, in my create I have: this.anims.create({ key: '_chestwaiting', frames: this.anims.generateFrameNames('chestwaiting'), repeat: -1 }); then later with a for cycle I do: for (let i = 0; i < 3; i++) { chests[i] = this.add.sprite(this.chests_positions[i].x, this.chests_positions[i].y).setOrigin(0, 0).play('_chestwaiting') but this way all 3 are synchronized waving up and down, so I wonder if there is a way to make them start with a random frame... hope I've been clear. Thanks a lot Link to comment Share on other sites More sharing options...
samme Posted December 4, 2018 Share Posted December 4, 2018 You can use the startFrame argument of play() or (I think) the delay argument of anims.delayedPlay(). giorg 1 Link to comment Share on other sites More sharing options...
jest Posted December 4, 2018 Share Posted December 4, 2018 ^ What samme said. let random = Phaser.Math.Between(range, maxRange); //put numbers here. chests[i] = this.add.sprite(this.chests_positions[i].x, this.chests_positions[i].y).setOrigin(0, 0).play('_chestwaiting', ignoreifPlayingBool, random) giorg 1 Link to comment Share on other sites More sharing options...
giorg Posted December 4, 2018 Author Share Posted December 4, 2018 thanks a lot guys. Link to comment Share on other sites More sharing options...
Recommended Posts