Mail Archives: djgpp/1999/02/16/18:22:22
You don't need to use readkey();
This waits for a key to be pressed, just omit the line.
Steve
Paradox wrote in message <7a9m5a$2q6 AT chronicle DOT concentric DOT net>...
>I'm a newbie programmer using DJGPP 2.02 with Allegro 3.0.
>
>
>My problem is this, the code compiles fine, but the screen looks goofy, and
>the ship moves funny. Also the music stops and restarts with every
>readkey(). Here is the movement code,
>
>void recieve_wishes(void) {
> readkey();
>
> if(key[KEY_UP]) {
> PS.last_location_y = PS.player_y;
> PS.last_location_x = PS.player_x;
> PS.player_y--;
> }
> if(key[KEY_DOWN]) {
> PS.last_location_y = PS.player_y;
> PS.last_location_x = PS.player_x;
> PS.player_y++;
> }
> if(key[KEY_LEFT]) {
> PS.last_location_y = PS.player_y;
> PS.last_location_x = PS.player_x;
> PS.player_x--;
> }
> if(key[KEY_RIGHT]) {
> PS.last_location_y = PS.player_y;
> PS.last_location_x = PS.player_x;
> PS.player_x++;
> }
> if(key[KEY_ESC]) { game_on = 0; }
>}
>
>void grant_wish(void) {
> PALETTE pal;
> BITMAP *ego = create_bitmap(320, 200);
> BITMAP *ship = load_bitmap("ship.bmp", pal);
> if(!ship) {
> printf("Can't find %s", ship);
> readkey();
> shutdown();
> }
> clear(ego);
>
> set_palette(pal);
>
> if(PS.last_location_y != PS.player_y || PS.last_location_x !=
PS.player_x)
>{
> blit(ship, ego, PS.last_location_x, PS.player_x, PS.last_location_y,
>PS.player_y, 320, 200);
> rest(60);
> vsync();
> blit(ego, screen, 0, 0, 0, 0, 320, 200);
> }
> destroy_bitmap(ego);
> destroy_bitmap(ship);
>}
>
>Help is appreciated. Thanks
>
>Paradox
>ennui AT nettaxi DOT com
>
>
>
- Raw text -