Message-ID: <3324690C.3CA2@swipnet.se> Date: Mon, 10 Mar 1997 21:03:24 +0100 From: Deltaman Reply-To: deltaman AT swipnet DOT se MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Newbie need help Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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++? ------------------------------------------------------------------------ ______ _______ _______ _______ _______ _______ __ _ | \ |______ | | |_____| | | | |_____| | \ | |_____/ |______ |_____ | | | | | | | | | \_|