Original Post
Here it is:
What happens is the background flashes once then the whole screen turns black except for the sprite, which moves around fine. I need to keep the background though!(Background is noobtown)
#include <allegro.h>int main(){ allegro_init(); install_keyboard(); set_color_depth(32); set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0); //startup BITMAP *buffer = NULL; buffer = create_bitmap(640,480); BITMAP *noobtown = NULL; noobtown = load_bitmap("noobtown.bmp", NULL); //towwn and buffer blit(noobtown, buffer, 0,0,0,0,640,480); BITMAP *sprite = NULL; sprite = load_bitmap("sprite.bmp", NULL); masked_blit(sprite, buffer, 0,0,0,0,0,0); int sprite_x = 0; int sprite_y = 0; //coords draw_sprite(buffer, sprite, sprite_x, sprite_y); blit(buffer, screen, 0,0,0,0,640,480); while(!key[KEY_ESC]){ if(key[KEY_RIGHT]) //moving{ sprite_x ++; } else if(key[KEY_LEFT]) { sprite_x --; }else if(key[KEY_UP]) { sprite_y --; } else if(key[KEY_DOWN]) { sprite_y ++; } draw_sprite(buffer, sprite, sprite_x, sprite_y); blit(buffer, screen, 0,0,0,0,640,480); clear_bitmap(buffer); } return 0; }END_OF_MAIN(); What happens is the background flashes once then the whole screen turns black except for the sprite, which moves around fine. I need to keep the background though!(Background is noobtown)