Sprite bounding box behaves well, but art is not centered

Hi all,

I have a sprite. Facing right, he looks like this:

image

With a rapid tap of the left key, the bounding box hardly moves (just a light tap–i was trying to not move that little guy), but my sprite flips to the opposite side of the box:

image

As you can see, the bounding box edge is aligned with my sprite’s spine. I want my bounding box behavior to stay as it is, but just shift the art inside the box. I’ve tried using body.setOffset(...), but that seems to have bad behavior on my bounding box.

Can someone point me the right direction? Thanks!

Are you trying to have the sprite stay positioned inside the bounding box, or as you said, you want the bounding box to always stay on the sprite’s spine?

I believe the bounding box (body) by default is positioned to your sprites origin. Did you set the offset of the body to be positioned on the sprite’s spine?

https://phaser.discourse.group/search?q=sprite%20flip

Sprite stay positioned in the bounding box is the goal.

flip flips the sprite’s image, who does not share a common center x with the body :confused: