playdate.graphics.image:rotatedImage is cutting off part of my image, why?

Hello! I am VERY new to programming and everything so bear with me please :slight_smile:

I'm working on a Pac-Man clone just to practice coding and I ran into an issue I don't really understand with rotating the image on my sprite. Without using rotatedImage, my animation plays fine:
image
(notice you can see the full circle)

However, adding a line of code applying rotatedImage cuts off the sides of my animation and makes this:
image

Here is the code, the only difference between the two screenshots is that I commented out the line "currentFrame = currentFrame:rotatedImage(0)" for the first screenshot. This problem occurs at 90 and 180 degrees as well. In addition, I'm definately still trying to wrap my head around how animation works (no PlayDate specific animation tutorials on YouTube yet XD) so I'd love any advice on how I coded that. Thank you!

local pd <const> = playdate
local gfx <const> = pd.graphics

class('Player').extends(gfx.sprite)

function Player:init()
    local playerImageTable = gfx.imagetable.new("images/pacman")
    self.playerAnimation = gfx.animation.loop.new(100, playerImageTable, true)
    self:moveTo(50,50)
    self:add()
end

function Player:update()
    local currentFrame = self.playerAnimation:image()
    currentFrame = currentFrame:rotatedImage(0)
    self:setImage(currentFrame, gfx.kImageUnflipped, 4)
end

I do believe this could be the same issue as: drawRotatedBitmap Draws from wrong center if degrees is one of the four cardinal directions

Will tag @dave

2 Likes