Page 1 of 1

How to use the sprite visibility flag

Posted: Tue Feb 24, 2015 1:06 am
by BroOfTheSun
In sprite_eng.c, there are two methods to set a sprite visibility:

Code: Select all

SPR_setAlwaysVisible(Sprite *sprite, u16 value)
SPR_setNeverVisible(Sprite *sprite, u16 value)
Should I use these methods to set the visibility on a sprite? Are these methods the correct way to update visibility instead of directly updating sprite visibility:

Code: Select all

sprite->visibility = TRUE;
sprite->visibility = FALSE;

Posted: Tue Feb 24, 2015 9:27 am
by Stef
You should not set sprite->visibility directly, the sprite engine computes it automatically. What you can do however is to use :

Code: Select all

SPR_setAlwaysVisible(sprite, TRUE)
or

Code: Select all

SPR_setNeverVisible(sprite, TRUE) 
to force a sprite to be always visible or always hidden in which case the Sprite engine won't recompute automatically the visibility field.