www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/10/16/20:49:01

From: "Brent Ritchie" <azreal AT cyberbeach DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Making a "Breakout" clone
Lines: 63
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Message-ID: <Dt4z7.1221$E67.167149@newsfeed.slurp.net>
Date: Tue, 16 Oct 2001 20:52:48 -0700
NNTP-Posting-Host: 216.104.101.12
X-Trace: newsfeed.slurp.net 1003279331 216.104.101.12 (Tue, 16 Oct 2001 19:42:11 CDT)
NNTP-Posting-Date: Tue, 16 Oct 2001 19:42:11 CDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello,

        I'm trying to make a level editor for my break out clone. But have
run into a snag. the following is a sample of my code:

/* This is my array of objects*/
class block{
            public:
                   int colour;
                   int hp;
                   int x;
                   int y;
                   int give_block(){return colour;return hp;return x;return
y;}
                   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);}
            }level[15][19];

/* This is my objects plot points*/
void array()
{
 level[0][0].x=10;
 level[0][0].y=10;
 level[0][1].x=30;
 level[0][1].y=10;
 level[0][2].x=50;
 level[0][2].y=10;
}

/* This is supposed to move the rectangle to the next part of the array and
the visible block to the next place on the left where each block can be
drawn p.s. each block is 20x5 pixels*/
void blockleft()
{
 if (stop_left == FALSE){
                         level[i][j - 1];
                         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);
                        }
 stop_right = FALSE;
}

/* Same as before but to the right*/
void blockright()
{
 if (stop_right == FALSE){
                          level[i][j + 1];
                          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);
                         }
 stop_left = FALSE;
}

The problem is that the blocks on screen don't move,anyone know why? or have
a different way. thank you.


- Raw text -


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