Jump to content

random frame on animation


Recommended Posts


in my create I have:

            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


  • Recently Browsing   0 members

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