I need help....with this program (i use C++ and Allego)

Hello people who are reading this!

I have a little problem with creating a background (i use C++ and Allego) inside the rest of this program!

This is the background code + the place where the character needs to walk:

BITMAP *(ground image)Sprite;

// the background
clear_to_color( screen, makecol( 255, 255, 255));

(ground image)Sprite = load_bitmap( " (ground image).bmp", NULL);

acquire_screen();

draw_sprite( screen, (ground image)Sprite, 420, 300);

release_screen();

And this what i have so far:

#include <allegro.h>

BITMAP *(character);
int x, y;

int main(){

allegro_init();
install_keyboard();
set_color_depth(16);
set_gfx_mode( GFX_AUTODETECT, 440, 480, 0, 0);

readkey();

Character = load_bitmap("Character.bmp", NULL);
x = 320;
y = 240;

while(!key[KEY_ESC]){

if (key[KEY_RIGHT]{
++x;
draw_sprite(screen, enemy, x,y);
}

else if (key[KEY_LEFT]){
--x;
draw_sprite(screen, enemy, x,y);
}
rest(10);
}



return 0;

}
END_OF_MAIN();


Last edited on
Hard to read, you must use the "//code" function. It would make code look better.
Topic archived. No new replies allowed.