delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/07/03:47:10

From: "Xee'Gh" <pekkaka AT dlc DOT fi>
Newsgroups: comp.os.msdos.djgpp
Subject: Array level building?
Date: 5 Aug 1998 18:05:43 GMT
Organization: Scifi Communications International, http://www.sci.fi/, helpdesk AT sci DOT fi, +358 3 2899111
Lines: 77
Message-ID: <01bdc097$e0e5e780$LocalHost@default>
NNTP-Posting-Host: cdxxvi.kdyn.saunalahti.fi
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi!
---
I started to do a level with array like the cutted code shows but but..
The number 0 is nothing and 1 is (or should be) red pixel,  So i need to
define
number as red.. Its 2D matrix array but i dont know how can i fill it with
the putpixel routine.I have a book but it is written so hard that i cant
understand it.
So if somebody would help me, please.

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.

by the way what happens if i take the 'int' out before peli[10][10] ?

I got 2 error messages which i cant fix.

1.int-array 'peli[0]' initiliazed from non-wide string.
2.parse error before 200. 

It looks simple on book but (there arent no examples) when i started to do
it , its hard.
Here is the code.... 

#include <allegro.h>


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



int  peli[10][10] ={ "0000100001" 
                     "1001010100"  
                     "1010001010"  
                     "0010001100"  
                     "0001010000"  
                     "0010001000"  
                     "1010001000"  
                     "1010000100"  
                     "0100000010"  
                     "0001000100" 
                     "0010101010" };
int MakeLevel()
{
int x, y;

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

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






-- 
He really needs help.

- Raw text -


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