delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/16/11:36:16

From: "Matt Huston" <mhuston AT ameritech DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: another allegro drawing question
Lines: 64
X-Newsreader: Microsoft Outlook Express 4.72.3110.1
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Message-ID: <k4mg4.371$u01.5912@nntp0.chicago.il.ameritech.net>
Date: Sun, 16 Jan 2000 11:09:02 -0500
NNTP-Posting-Host: 206.141.244.157
X-Trace: nntp0.chicago.il.ameritech.net 948039056 206.141.244.157 (Sun, 16 Jan 2000 10:10:56 CDT)
NNTP-Posting-Date: Sun, 16 Jan 2000 10:10:56 CDT
Organization: Ameritech.Net www.ameritech.net Complaints: abuse AT ameritech DOT net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Okay, I have two pong paddles that move accross the screen.  They move and
all ,but leave a smeere accross
the screen.  They are 150x25x8 bit BITMAPs in a datafile.  You may find this
code useful in helping me.

Thanks,
M. Huston

////////////////////////////////////////////////////

void draw_pong()
{
 draw_sprite(BUFFER, GAMEDATA[BMPPONG1].dat, pong1_x, pong1_y);
 draw_sprite(BUFFER, GAMEDATA[BMPPONG2].dat, pong2_x, pong2_y);


 blit(BUFFER,screen,0,0,0,0,640,480);
 // vsync(); //It made the paddles move slower so I left it out
}


void move_pong()
{
 if(key[KEY_LEFT])
 {
// Moves the player pong LEFT
  pong1_x--;

 }
 if(key[KEY_RIGHT])
 {
// Moves the player pong RIGHT
  pong1_x++;
 }

 if(key[KEY_A])
 {
  pong2_x--;
 }
 if(key[KEY_S])
 {
  pong2_x++;
 }

// My Primitive wall collision detection code :)
 if(pong1_x <= 0)
 {
  pong1_x = 0;
 }
 if(pong1_x >= 480)
 {
  pong1_x = 480;
 }
 if(pong2_x <= 0)
 {
  pong2_x = 0;
 }
 if(pong2_x >= 480)
 {
  pong2_x = 480;
 }
}


- Raw text -


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