Mail Archives: djgpp/1998/08/05/14:45:48
Xee'Gh wrote:
> 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.
Here's your problem!!!
int peli[10][10] ={ "0000100001"
"1001010100"
"1010001010"
"0010001100"
"0001010000"
"0010001000"
"1010001000"
"1010000100"
"0100000010"
"0001000100"
"0010101010" };
it should look like this:
char array[4][4] ={{0,1,0,0},
{1,0,1,0},
{0,1,0,0},
{0,1,0,0}, };
/Conan
- Raw text -