Is it possible to rotate a sprite about an arbitrary point?

Sorry if this is off-topic or I should be searching somewhere else...

I'm working on my first game for the playdate and want to rotate a sprite to look like it is bowing when the crank is rotated, however at the moment, it rotates around its center. (See images below [ignore sprite image quality :sweat_smile:])

Output 2023-08-25 07.23.16
Output 2023-08-25 07.23.28
Output 2023-08-25 07.23.40

Is there a way to change this rotation point to be at the bottom of the sprite?

As is probably most likely the case, I think I have found a solution to my own question.

A bit hacky, but I made the image canvas twice as long with transparent content at the bottom, thus, now the center point is at the previous bottom. He does his bow like a pro now.

If your sprite is backed by an image, I believe yourSprite:setCenter(0.5, 1) would do what you're wanting without needing to pad the image.

5 Likes

I can confirm, this works!

Thanks so much <3

1 Like