Mail Archives: djgpp/1998/01/28/18:00:31
Matt Riker writes:
>The normal format for drawing a sprite from the datafile is this:
>
>draw_sprite(doublebuffer, datafile[SPRITENAME].dat, 16, 16);
>
>But because SPRITENAME is constantly changing, I need to put in a
>variable instead.
So, put it in a variable! There is no problem with that. The object ID
is just an integer value that is being used to index into the datafile
array, so it can come from wherever you like. Your SPRITENAME symbol is
#defined to a particular value in the header file that the grabber
produces, but it is a normal numeric constant: there is nothing magical
about it.
See the ex21.c program for an example of how to compute the object ID
for an animating sprite.
--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
"Pigs use it for a tambourine" - Frank Zappa
- Raw text -