   What's wrong with my code?
  this is allegro:#include <allegro.h>int main(int argc, char *argv[]) {allegro_init();install_keyboard();set_color_depth(16);set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0);BITMAP *heroleft = NULL;heroleft = load_bitmap("left.bmp", NULL);BITMAP *heroright = NULL;heroright = load_bitmap("right.bmp", NULL);BITMAP *heroimage = NULL;heroimage = load_bitmap ("right.bmp", NULL); int my_pic_x = 0; int my_pic_y = 0;while(!key[KEY_ESC])//If the user hits escape, quit the program {draw_sprite(screen, heroimage, my_pic_x, my_pic_y); if (key[KEY_LEFT]){heroimage = heroleft;}else if (key[KEY_RIGHT]){heroimage = heroright; }}return 0;}END_OF_MAIN()heres what happens: when i press left the heroleft overlaps heroright, so i can see them both overlapping, and then I press another button and the one on top sort of half moves while the one on bottom just stays there. does anyone know how to fix this? also when i put movement into it it left a "ghost" of the image behind it, if that makes sense, like a streak of its image. someone please help!!![Edited by - Chocolate on June 30, 2009 7:38:55 PM]
  What's wrong with your code? Your post lacks [ source ] [ /source ] tags. (Remove spaces to use them and see the FAQ in the upper-right corner for additional instructions.) The computer is doing exactly what you told it to do:  It's drawing images without clearing the screen or page-flipping. You're not posting in the beginners' forum so when you run into trouble try to figure it out yourself before posting here. (You can indicate this by telling us what you've tried to do to fix your code.)Other than that your code is just fine!   ;  well ive tried putting in clear_bitmap and destroy_bitmap and blit but none of it seems to work. Sorry i should have posted this in the beginners, my bad. But i am a beginner so how do i fix this?   ;  See the exflip example that came with Allegro.   