Cut image in sprite and animation

Hello !

I don't understand how work with image which contains multiple sub images (sprite assert) :slightly_frowning_face:


I have this image. I want to create sprite with only one part of this image. I saw it's possible with this :
gunImage:draw(0, 0, gfx.kImageUnflipped, 0, 0, 50, 50)
but I don't understand how use it in a sprite object

Same question with animation. I know I should create imagetable, but how with only one image ?

Should we cut all sub images ?


SDK : 1.12.3
OS : Windows

An image table isn't a standard sprite sheet. All cells of the image table need to be the same dimensions. The width and height of the cell are to be placed in the filename.

So, you need to prepare your sprite image differently. When working on Playdate it's not needed to optimise it like you have.

Finally, once you've loaded the image table you reference the element to retrieve that image, you can set the image of the sprite to one of the images.

1 Like

Thanks for your response. I decide to create custom code to manage animation with different images size.

1 Like