Playdate.graphics.image:clear() seems to duplicate setColor()

Currently running 2.4.2 on Windows 11.

Attempting to create some fun animation effects by conditionally cleaning certain sprites on screen, however when attempting to run a clear against a single sprite, all it appears to do is set the sprites color to the colour defined by it's output.

Here is the scene if I'm using playdate.graphics.clear():
playdate-20240419-091133

Now if I comment out gfx.clear() and replace with:
playdate.graphics.self.horse:clear()

My expectation would be that all other sprites onscreen will fail to clear, but my horse sprite will clear like the global function, using the background color.

This will fail however requesting a color value to be added to the image:clear() function.

Here it is with kColorWhite:
horsey(white)

and here with kColorClear:
horsey(clear)

This appears to currently perform the same function as setColor and is not overwritten by the next draw function called.

OK so in this case it seems I was misinterpretting what the image:clear() function was doing.

I was assuming that it only wrote the single instance of color change at time of function run, and did not think it would retain the mask on the next draw.

1 Like