Hi, I have a fish sprite that I’m creating like this:
playerFish = this.physics.add.sprite(
this.game.scale.width / 2,
this.game.scale.height / 2,
'fish').setOrigin(0.5)
By default it’s facing to the right, but when it’s moving to the left I would like it to be facing to the left. Currently, I’m using this code:
playerFish.scaleX = -1
This does flip the image, but it seems to flip it around the zero x point of the sprite, not around the origin anchor point. Also, the hitbox bounds oddly doesn’t get flipped.
I must be doing something wrong here. Can someone please tell me the correct way to horizontally flip a sprite without physically moving it’s position (or the image position)?
Thanks!