delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/05/15:46:15

From: Vic <tudor AT cam DOT org>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Array level building?
Date: Wed, 05 Aug 1998 14:26:26 -0400
Organization: Communications Accessibles Montreal, Quebec Canada
Lines: 84
Message-ID: <35C8A3D2.67E@cam.org>
References: <01bdc097$e0e5e780$LocalHost AT default>
NNTP-Posting-Host: dialup-822.hip.cam.org
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Xee'Gh wrote:
> This is huge favour to me if somebody would fix my code that way that it
> works.
> or least tell me how fix if nothing else.
> I use putpixel now because its easier than using bitmaps to number one.

there were several mistakes in it. yopu can find a fixed version down.

> int  peli[10][10] ={ "0000100001"
>                      "1001010100"

you can't do this. you are initialising an array of ints, not strings.
it should be
 int peli[10][10]={
              {0,1,1,0,4,54,2,1},
              {4,2,3,2,6,51,1,2},
etc.  

 
> for (y=0; y<10; y++)
> {
> for (x=0; x<10; x++)
> {
>  if (peli[3][4])

I think you meant if(peli[x][y]) here

> set_gfx_mode(GFX_AUTODETECT, 320 200, 0, 0);

you get a parse error because you forgot a colon, it's 320,200 not 
320 200

> kbhit();

again here I think you mean while(!kbhit()) sice kbhit just returns 1 if
there was a key press, it does not wait for one.
I don't understamnd what game you are trying to make and I can't help
with the other problems. maybe if you would explain more....



#include <allegro.h>


DATAFILE *data;
BITMAP *bmp, *page1, *page2, *page3;



int  peli[10][10] ={ {0,0,0,0,1,0,0,0,0,1},
                     {1,0,0,1,0,1,0,1,0,0},
                     {1,0,1,0,0,0,1,0,1,0},
                     {0,0,1,0,0,0,1,1,0,0},
                     {0,0,0,1,0,1,0,0,0,0},
                     {0,0,1,0,0,0,1,0,0,0},
                     {1,0,1,0,0,0,1,0,0,0},
                     {1,0,1,0,0,0,0,1,0,0},
                     {0,1,0,0,0,0,0,0,1,0},
                     {0,0,0,1,0,0,0,1,0,0}
                     };
int MakeLevel()
{
int x, y;

for (y=0; y<10; y++)
{
for (x=0; x<10; x++)
{
 if (peli[x][y])
  {
  putpixel(screen, x, y, 93);
  }
 }
}
}

void main()
{
allegro_init();
set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0);
MakeLevel(); /*parse error*/
while(!kbhit());
allegro_exit();
}

- Raw text -


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