 |
Das erste Spiel: PacMan.
1.
Lege im Code Editor ein neues File Tile1.c an:
#include
<gb/gb.h>
const unsigned char tiledata[] =
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0:=nichts
0,0,0,0,0,24,16,44,0,60,0,24,0,0,0,0, // 1:Pille
62,62,119,119,252,252,240,240,240,240,252,252,127,127,62,62,
// 2:PacMan
255,32,255,32,255,32,255,255,255,1,255,1,255,1,255,255
// 3:Mauer
};
#define NIX 0
#define PILLE 1
#define PACMAN 2
#define MAUER 3
unsigned char tiles[] =
{NIX,PILLE,PACMAN,MAUER};
void main()
{int x,y;
SHOW_BKG;
set_bkg_data(0,4,tiledata);
for (x=0;x<20;x++)
for (y=0;y<18;y++)
set_bkg_tiles(x,y,1,1,tiles+PILLE); //Bildschirm
mit Pillen
set_bkg_tiles(10,9,1,1,tiles+PACMAN); // PacMan
in die Mitte
} |
2. übersetze
und starte den Code. Vergiss nicht, für dieses neue
Projekt ein
neues Batch File anzulegen.
|