0 Members and 1 Guest are viewing this topic.
for(int y = 0; y < MapHeight; y++) for(int x = 0; x < MapWidth; x++) { tile = MapArray[x + (y * MapWidth)]; if tile == 0 //Draw Something at x * 8,y * 8 if tile == 1 //Draw something else at x * 8,y * 8 }
[HEXCODE]->Pic1[MapDataInNibbles]->GDB1For(A,0,95)nib{A+GDB1*2}->BA^12->XA/8->YPt-off(X*8,Y*8,B*8+Pic1)End
[HEXCODE]->Pic1 //this is the place where you put the hex data for all of your sprites, one after another.[MapDataInNibbles]->GDB1 //this holds the map data in nibbles, which basically just means that every four bits holds a binary number from 0 to 15 (or 0 to F) to describe what tile to draw in what location. here they are listed in rows of twelve.For(A,0,95) //a for loop. 12*8 (the screens width and height in increments of 8) is 96, so it has to run from sprite 0 to sprite 95 in order to cover the whole screen.nib{GDB1*2+A}->B //this gets the sprite that is to be drawn next. it uses a "nibble pointer" rather than a "byte pointer" (i'm not sure what these are actually called...), so the "byte pointer" location of GDB1 has to be doubled. A is then added to determine which one to draw currently.A^12->X //a modulus 12, or the whole integer remainder that would remain after A is divided by 12 is stored to XA/8->Y //the integer value of A, were it divided by 8, is stored to YPt-off(X*8,Y*8,B*8+Pic1) //drawing sprites to the screen. because B holds a value from 0 to 15, multiplying this by 8 and adding Pic 1 slides the pointer to the spot where you stored your sprite data and then jumps forward to the number desired.End