Mail Archives: djgpp/1997/03/10/15:19:48
Hi!
I've got four functions in my program that blit a sprite in a specific
direction. Is there any way to reuse this function to different
directions?
They are exactly the same except for the key that triggers the blitting,
the direction (xpos, ypos) and sprite that I blit to the sprite buffer.
void walk_left () {
int counter;
counter = 0;
while (key[KEY_LEFT])
{
if (counter > 3) counter = 0;
if (counter == 0) blit (data[LEFT_2].dat,
sprite_buffer,0,0,0,0,32,64);
if (counter == 1) blit (data[LEFT_3].dat,
sprite_buffer,0,0,0,0,32,64);
if (counter == 2) blit (data[LEFT_2].dat,
sprite_buffer,0,0,0,0,32,64);
if (counter == 3) blit (data[LEFT_1].dat,
sprite_buffer,0,0,0,0,32,64);
my_update_function(); */ Does all the double-buffering and sprite
updating and more/*
xpos--;
counter++;
}
}
Also, I've read some tutorials and a newbie book and feel somewhat
comfortable
with c. Where can I learn more (there are a lot of tutorials but only a
few 'after the
tutorials') and eventually begin with c++?
------------------------------------------------------------------------
______ _______ _______ _______ _______ _______ __ _
| \ |______ | | |_____| | | | |_____| | \ |
|_____/ |______ |_____ | | | | | | | | | \_|
- Raw text -