Mail Archives: djgpp/2001/10/17/02:05:19
From: | "Rob Kramer" <robk AT cyberway DOT com DOT sg>
|
Newsgroups: | comp.os.msdos.djgpp
|
References: | <Dt4z7.1221$E67 DOT 167149 AT newsfeed DOT slurp DOT net>
|
Subject: | Re: Making a "Breakout" clone
|
Date: | Wed, 17 Oct 2001 13:46:02 +0800
|
Lines: | 55
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 5.50.4133.2400
|
X-MIMEOLE: | Produced By Microsoft MimeOLE V5.50.4133.2400
|
NNTP-Posting-Host: | 203.116.120.90
|
Message-ID: | <3bcd1c09@news.starhub.net.sg>
|
X-Trace: | 17 Oct 2001 13:50:01 +0800, 203.116.120.90
|
Organization: | StarHub Internet Pte Ltd
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hey Brent,
Oh, just for fun, a few remarks:
> /* This is my array of objects*/
> class block{
> public:
...
> int give_block(){return colour;return hp;return
x;return
> y;}
What's that supposed to do?
> void draw_block(int a,int b,int c,int d){colour = a;hp
=
> b;x = c;y = d;rectfill(screen,x,y,x + 20,y + 5,colour);}
Or, use the coordinates stored in your object. Call block->draw (screen);
Or screen->draw (block);
> /* This is my objects plot points*/
> void array()
> {
> level[0][0].x=10;
> level[0][0].y=10;
level[0][0].setCoordinate (10, 10);
> if (stop_left == FALSE){
> level[i][j - 1];
This is a no-op..
> rect(screen,level[i][j + 1].x,level[i][j +
> 1].y,level[i][j + 1].x + 20,level[i][j + 1].y + 5,0);
>
> rect(screen,level[i][j].x,level[i][j].y,level[i][j].x - 20,level[i][j].y -
> 5,7);
This is hard to read, use level[i][j].draw(), and perhaps
level[i][j].clear() to restore the background. For a better way of dealing
with game loops, see the Allegro game programming tutorial.
> The problem is that the blocks on screen don't move,anyone know why?
No, you didn't include the main control loop and a lot of other stuff. Try
using gdb to see what goes wrong.
Have fun :)
Rob
- Raw text -