delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/16/18:22:22

From: "Steve" <steve AT maltbysoft DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Newbie Game
Date: Tue, 16 Feb 1999 23:13:32 -0000
Organization: Customer of Planet Online
Lines: 76
Message-ID: <7acu56$tm1$1@news7.svr.pol.co.uk>
References: <7a9m5a$2q6 AT chronicle DOT concentric DOT net>
NNTP-Posting-Host: modem-121.argon.dialup.pol.co.uk
X-Trace: news7.svr.pol.co.uk 919206886 30401 62.136.8.249 (16 Feb 1999 23:14:46 GMT)
NNTP-Posting-Date: 16 Feb 1999 23:14:46 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019