[Phaser 3] Spine Examples (change skins, animations and attachments)

Voila this should do it :slight_smile:

// add the spine object
const hero = this.add.spine(0, 0, 'dude', 'idle', true)

// add the body
this.physics.add.existing(hero)

// define the setFlipX function
hero.setFlipX = function(flip) {
  if (flip) {
    this.body.setOffset(hero.width, 0)
    this.setScale(-1, 1)
  } else {
    this.body.setOffset(0, 0)
    this.setScale(1, 1)
  }
}

// flip the spine object and its body
hero.setFlipX(true)
// or 
hero.setFlipX(false)
2 Likes