Trouble Drawing Sprites

Hello all,
I'm very new to Lua and trying to draw a sprite to the entire screen
The Object Containing the Sprite

The Main

image
The sprite looks like its loading properly, but only the fps widget draws. Can anyone help me understand my mistake please?

Hi Jay, from the code you posted it looks like you’re missing the call to playdate.graphics.sprite.update() which draws all sprites.

Veubeke, thanks for the response. I've refactored my main drawing function like this:

image

Every loop it does print "1" for the 1 sprite I'm loading, but still only shows a blank screen and the FPS indicator.

I've tried with and without .clear()

It’s possible that your sprite is offscreen. You can call graphics.sprite.moveTo to move the sprite around. With moveTo(200,120) it should be centered.
If you still don’t see anything you can enable "Highlight Screen Updates" in the simulator which can help check if your sprite is in the right place but not visible for other reasons.

1 Like

I was running into something similar and the issue was I needed to set a size on my sprite via self:setSize(width, height)

Since this has come up more than once I'm thinking we shouldn't clip drawing when a sprite size hasn't been set. I'll file that and check it out when I have a chance.

1 Like