devkitSMS icon indicating copy to clipboard operation
devkitSMS copied to clipboard

Tile Id Offset Meta Sprite Feature Request

Open xfixium opened this issue 1 year ago • 2 comments

I don't know if this has been implemented yet, or exists. Say a metasprite has been defined eg:

// Frame 0 of multi framed sprite, for entity with loads of states, but tiles may be located differently for each instance: const unsigned char sprite_00[] = { 0, 0, 0, 8, 0, 2, 16, 0, 4, 0, 16, 6, 8, 16, 8, 16, 16, 10, 0, 32, 12, 8, 32, 14, METASPRITE_END };

Is there a way to offset the tile id, so that the tile id starts with the array tile id + offset?

Sort of like: SMS_addMetaSprite(x, y, [offset], sprite_00);

Where [offset] would be applied to the defined tile id for each sprite.

xfixium avatar May 11 '24 14:05 xfixium

Quite recently in fact I hacked in something along that line, but you need to recompile the library adding the METASPRITE_DELTA_TILES define to the compilation. Then the offset can be stored into the MetaSpriteBaseTile variable (unsigned char) and the SMS_addMetaSprite function will then work the way you expect. You can see this in the code here.

sverx avatar May 11 '24 16:05 sverx

Oh very nice, that should do it!

xfixium avatar May 11 '24 16:05 xfixium