How to use the sprite visibility flag

SGDK only sub forum

Moderator: Stef

Post Reply
BroOfTheSun
Interested
Posts: 33
Joined: Fri Dec 12, 2014 2:41 am
Location: USA - Chicago, IL

How to use the sprite visibility flag

Post 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;
Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post 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.
Post Reply