11-11-2019, 05:57 PM
Hi,
In Tilengine, like in any 2D graphics chipset, you can't create sprites dynamically, but are limited to a predefined amount. You choose this initial amount. For example the Sega Genesis had 80 sprites, the SNES had 128, and the NeoGeo 380. You configure, enable and disable sprites based on their fixed index. But you don't create or destroy sprites.
Let's assume you have a spriteset in the pair of files "bullets.tsx" and "bullets.png", with many bullets, and one of them is called "fireball".
Hope this makes some sense now, let me know!
In Tilengine, like in any 2D graphics chipset, you can't create sprites dynamically, but are limited to a predefined amount. You choose this initial amount. For example the Sega Genesis had 80 sprites, the SNES had 128, and the NeoGeo 380. You configure, enable and disable sprites based on their fixed index. But you don't create or destroy sprites.
Let's assume you have a spriteset in the pair of files "bullets.tsx" and "bullets.png", with many bullets, and one of them is called "fireball".
Code:
/* Load the spriteset once and find the desired graphic: */
Spriteset bullets = TLN_LoadSpriteset("bullets");
int fireball = TLN_FindSpritesetSprite(bullets, "fireball");
/* set sprite 5 and 6 with fireball. Do for as many sprites as you wish */
TLN_SetSpriteSet(5, bullets);
TLN_SetSpritePicture(5, fireball);
...
TLN_SetSpriteSet(6, bullets);
TLN_SetSpritePicture(6, fireball);
Hope this makes some sense now, let me know!