   When one image is interacted with how can I remove it form the screen? [Allegro]
  Hey guys Im making a space themed Pickin sticks clone lol and Ive got it all down except some nit picky crap and I still need to get this one thing working. I'm trying to gather plutonium in my space themed game however when I try to gather the plutonium a new resource appears as it should, but how cna I remove the old one from the screen, any help? my code is below<souce>#include <allegro.h>volatile long speed_counter = 0;void increment_speed_counter(){speed_counter++;}END_OF_FUNCTION(increment_speed_counter);int main(){allegro_init();install_timer();install_sound(DIGI_AUTODETECT, MIDI_AUTODETECT, NULL);install_keyboard();set_color_depth(16);set_gfx_mode(GFX_AUTODETECT,640,480,0,0);srand(time(NULL));  int spawn_y = rand()%600;   int spawn_x = rand()%480;  LOCK_VARIABLE(speed_counter);  LOCK_FUNCTION(increment_speed_counter); // speed.  install_int_ex(increment_speed_counter, BPS_TO_TIMER(60)); // Set our BPS  BITMAP *grass = NULL;  grass = load_bitmap("space.bmp", NULL);  BITMAP *picture1 = NULL;  picture1 = load_bitmap("AlienCraft.bmp", NULL);  BITMAP *picture2 = NULL;  picture2 = load_bitmap("AlienCraft2.bmp", NULL);  BITMAP *resource = NULL;  resource = load_bitmap("resource.bmp", NULL);  BITMAP *resource2 = NULL;  resource2 = load_bitmap("resource2.bmp", NULL);  BITMAP *cover = NULL;  cover = load_bitmap("transparent.bmp", NULL);  BITMAP *buffer = NULL;  buffer = create_bitmap(640, 480);  int resource_x = 100; // Set the x position of image 2 to 100.  int resource_y = 100; // Set the y position of image 2 to 100.  int picture_x = 0;  int picture_y = 0;  int image1_bb_left = picture_x;  int image1_bb_top = picture_y;  int image1_bb_right = (image1_bb_left + picture1->w);  int image1_bb_bottom = (image1_bb_top + picture1->h);  int image2_bb_left = resource_x;  int image2_bb_top = resource_y;  int image2_bb_right = (image2_bb_left + resource->w);  int image2_bb_bottom = (image2_bb_top + resource->h);  int frame_counter = 0;  int show_bbox = FALSE;  int collision = FALSE;  int points = 0;  SAMPLE *song;  song = load_sample("songCowTippin.wav");  int panning = 128;  int pitch = 1000;  int volume = 128;while(!key[KEY_ESC]){play_sample(song, volume, panning, pitch, true);blit(grass, buffer,0,0,0,0,640,480);masked_blit(resource, grass,0,0,resource_x,resource_y,640,480);textprintf_ex(buffer, font, 200,0, makecol(255,255,255), -1, "Score: %i", points);if(points <= 10){textprintf_ex(buffer, font, 400,0, makecol(255,255,255), -1, "Rank: Noob-a-saurus-rex", points);}if(points >= 11 && points <= 19){textprintf_ex(buffer, font, 400,0, makecol(255,255,255), -1, "Rank: Space cadet", points);}if(points >= 20 && points <= 29){textprintf_ex(buffer, font, 400,0, makecol(255,255,255), -1, "Rank: seeing eye monkey", points);}if(points >= 30 && points <= 40){textprintf_ex(buffer, font, 400,0, makecol(255,0,0), -1, "Rank: Astronaut!", points);}if(points >= 41 && points <= 56){textprintf_ex(buffer, font, 400,0, makecol(100,0,255), -1, "Rank: Buzz Aldrin!", points);}if(points >= 57 ){textprintf_ex(buffer, font, 400,0, makecol(0,0,255), -1, "Rank: Plutonium Farmer!", points);}int speed = 3;  while(speed_counter > 0)   {    if(key[KEY_RIGHT]) {   picture_x = picture_x + speed; }if(key[KEY_LEFT]) {   picture_x = picture_x - speed; }if(key[KEY_UP]) {   picture_y = picture_y - speed; }if(key[KEY_DOWN]) {   picture_y = picture_y + speed; }   if(key[KEY_B])  show_bbox = TRUE;else if(!key[KEY_B])  show_bbox = FALSE;  image1_bb_left = picture_x;  image1_bb_top = picture_y;  image1_bb_right = (image1_bb_left + picture1->w);  image1_bb_bottom = (image1_bb_top + picture1->h);  image2_bb_left = resource_x;  image2_bb_top = resource_y;  image2_bb_right = (image2_bb_left + resource->w);  image2_bb_bottom = (image2_bb_top + resource->h);collision = TRUE;    if(image1_bb_bottom < image2_bb_top){    collision = FALSE;}else if(image1_bb_top > image2_bb_bottom){    collision = FALSE;}else if(image1_bb_right < image2_bb_left){    collision = FALSE;}else if(image1_bb_left > image2_bb_right){    collision = FALSE;} speed_counter --;frame_counter ++;if(frame_counter > 240) // 60 * 4 = 240 (When frame counter = 60, 1 second has passed){  frame_counter = 0;}} if(frame_counter < 60) // Less than a full second{  draw_sprite(buffer, picture1, picture_x, picture_y); // Draw the first frame    draw_sprite(buffer, resource, resource_x, resource_y);}else if(frame_counter >= 60 && frame_counter < 120) // Between 1 and 2 seconds{  draw_sprite(buffer, picture2, picture_x, picture_y); // Draw the second frame    draw_sprite(buffer, resource2, resource_x, resource_y);}else if(frame_counter >= 120 && frame_counter < 180) // If we are between 2 and 3 seconds{  draw_sprite(buffer, picture1, picture_x, picture_y); // Draw the first frame again,   // to acheive better effect  draw_sprite(buffer, resource, resource_x, resource_y);}else // If we are over 3 seconds{  draw_sprite(buffer, picture2, picture_x, picture_y); // Draw the last frame.    draw_sprite(buffer, resource2, resource_x, resource_y);}if(show_bbox == TRUE){line(buffer, image1_bb_left, image1_bb_top, image1_bb_right, image1_bb_top, makecol(255,0,0));line(buffer, image1_bb_left, image1_bb_bottom, image1_bb_right, image1_bb_bottom, makecol(255,0,0));line(buffer, image1_bb_left, image1_bb_top, image1_bb_left, image1_bb_bottom, makecol(255,0,0));line(buffer, image1_bb_right, image1_bb_top, image1_bb_right, image1_bb_bottom, makecol(255,0,0));line(buffer, image2_bb_left, image2_bb_top, image2_bb_right, image2_bb_top, makecol(255,0,0));line(buffer, image2_bb_left, image2_bb_bottom, image2_bb_right, image2_bb_bottom, makecol(255,0,0));line(buffer, image2_bb_left, image2_bb_top, image2_bb_left, image2_bb_bottom, makecol(255,0,0));line(buffer, image2_bb_right, image2_bb_top, image2_bb_right, image2_bb_bottom, makecol(255,0,0));}if(collision == TRUE && key[KEY_SPACE]){points = points + 1;   textprintf_ex(buffer, font, 0,0, makecol(255,255,255), -1, "Collecting resource....");   masked_blit(cover,buffer, 0,0,resource_x,resource_y,640,480);   // note: I cannot get this line of code to work, cover is supposed to be a transparent square    //that will cover over an old resource   // any idea what I should do here?   int spawn_y = rand()%400;   int spawn_x = rand()%600;   resource_x = spawn_x;   resource_y = spawn_y;   }blit(buffer, screen,0,0,0,0,640,480);clear_bitmap(buffer); } destroy_bitmap(cover); destroy_sample(song); destroy_bitmap(grass); destroy_bitmap(picture1);  destroy_bitmap(picture2); destroy_bitmap(resource); destroy_bitmap(resource2); destroy_bitmap(buffer);  return 0;}END_OF_MAIN()</source>on a side note: im trying to play music also however when I go to play the music, it must be using the same timer as the animation so how could I get it to run on a seperate timer? or just any other way to get it to play without ruining the animation.   