You are not logged in.

#1 2010-10-19 20:28:38

Dude
Member

Filling screen with 16x16 tiles?

I'm making a pac-man clone, and I'm using TileStudio to draw the maps. Does anyone know why this implementation doesn't work for filling the screen with tiles?

Code:

        /*------======Tile Drawing=======----------*/
        unsigned short horiz_current = 16;
        unsigned short vert_current = 24;
        
        for(l=0; l <= (27); l++);
        {
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][0]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][1]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][2]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][3]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][4]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][5]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][6]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][7]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][8]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][9]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][10]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][11]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][12]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][13]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][14]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][15]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][16]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][17]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][18]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][19]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][20]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][21]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][22]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][23]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][24]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][25]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][26]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][27]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][28]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][29]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][30]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][31]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][32]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][33]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][34]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][35]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][36]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][37]); horiz_current = horiz_current +16;
            vert_current = vert_current * (l+1)*16;
        }

I tried a similar implementation earlier where the loop drew the horizontal tiles as well, but it only drew one tile (or possibly all of the tiles on top of eachother). Map1Data is just a two dimensional array of [30][40]. This current implementation only draws the top row of tiles, and I'd like to to do all of them.

Last edited by Dude (2010-10-19 21:52:26)

Offline

 

#2 2010-10-20 02:47:13

mdbrim
Member

Re: Filling screen with 16x16 tiles?

you need to reset horiz_current at the start of each loop...

for(l=0; l <= (27); l++);
        {
            horiz_current = 0; (or whatever your start point is)
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][0]); horiz_current = horiz_current +16;
            GRRLIB_DrawTile(horiz_current, vert_current, tileset_map1, 0, 1, 1, GRRLIB_WHITE, Map1Data[l][1]); horiz_current = horiz_current +16;
.....

Offline

 

#3 2010-10-21 06:39:54

Dude
Member

Re: Filling screen with 16x16 tiles?

Thanks for your help mdbrim, I've gotten the tile renderer working excellently. However, I'm running into another issue:

Code:

signed short Map1Data[29][39] = // this is a global btw
  {{ 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1},
  { 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 6},
  { 3, 5, 7, 8, 8, 9, 5, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,10, 8, 8, 8,10, 8, 8, 8,
    8, 8, 8, 8, 8, 8, 9, 5, 7, 8, 8, 9, 5, 6},
  { 3, 5,11,12,12,11, 5,11, 5, 5, 5, 5, 5, 5, 5, 5, 5,11,12,12,12,11, 5, 5, 5,
    5, 5, 5, 5, 5, 5,11, 5,11,12,12,11, 5, 6},
  { 3, 5,13, 8, 8,14, 5, 6, 9, 5, 5, 5, 5, 5, 5, 5, 5,13, 8, 8, 8,14, 5, 5, 5,
    5, 5, 5, 5, 5, 7, 3, 5,13, 8, 8,14, 5, 6},
  { 3, 5, 5, 5, 5, 5, 5,13,14, 5,15, 8, 8, 8, 8, 9, 5, 5, 5, 5, 5, 5, 5, 7, 8,
    8, 8, 8,16, 5,13,14, 5, 5, 5, 5, 5, 5, 6},
  { 3, 5,15, 8, 8, 9, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 8, 8,16, 5,15, 8, 8, 3, 5,
    5, 5, 5, 5, 5, 5, 5, 5, 7, 8, 8,16, 5, 6},
  { 3, 5, 5, 5, 5,13, 8, 8, 8,16, 5, 7, 8,16, 5,11, 5, 5, 5, 5, 5, 5, 5,11, 5,
   15, 8, 9, 5,15, 8, 8, 8,14, 5, 5, 5, 5, 6},
  { 3, 5, 7, 9, 5, 5, 5, 5, 5, 5, 5,11, 5, 5, 5,11, 5, 5, 7, 8, 9, 5, 5,11, 5,
    5, 5,11, 5, 5, 5, 5, 5, 5, 5, 7, 9, 5, 6},
  {17, 5, 6, 3, 5,18, 5, 7, 8, 8, 8, 3, 5,15, 8,14, 5, 7,14,12,13, 9, 5,13, 8,
   16, 5, 6, 8, 8, 8, 9, 5,18, 5, 6, 3, 5,17},
  {12, 5, 6, 3, 5,11, 5,11,12,12,12,11, 5, 5, 5, 5, 5,11,12,12,12,11, 5, 5, 5,
    5, 5,11,12,12,12,11, 5,11, 5, 6, 3, 5,12},
  {18, 5,13, 3, 5,11, 5,11,12,12,12,11, 5,15,10,16, 5,13, 8, 8, 8,14, 5,15,10,
   16, 5,11,12,12,12,11, 5,11, 5, 6,14, 5,18},
  { 3, 5, 5,11, 5,11, 5,13, 8, 8, 8,14, 5, 5,17, 5, 5, 5, 5, 5, 5, 5, 5, 5,17,
    5, 5,13, 8, 8, 8,14, 5,11, 5,11, 5, 5, 6},
  { 1, 9, 5,11, 5,11, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7,16,19,19,19,15, 9, 5, 5,
    5, 5, 5, 5, 5, 5, 5, 5,11, 5,11, 5, 7,20},
  { 1, 3, 5,11, 5,17, 5,15, 8, 8, 8,16, 5,18, 5, 5,11,12,12,12,12,12,11, 5, 5,
   18, 5,15, 8, 8, 8,16, 5,17, 5,11, 5, 6,20},
  { 1, 3, 5,11, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 9, 5,11,12,12,12,12,12,11, 5, 7,
    3, 5, 5, 5, 5, 5, 5, 5, 5, 5,11, 5, 6,20},
  { 1, 3, 5,13, 8, 8,10, 8,16, 5,15, 8, 8, 2,14, 5,11,12,12,12,12,12,11, 5,13,
    2, 8, 8,16, 5,15, 8,10, 8, 8,14, 5, 6,20},
  { 1,14, 5, 5, 5, 5,11, 5, 5, 5, 5, 5, 5, 5, 5, 5,13, 8, 8, 8, 8, 8,14, 5, 5,
    5, 5, 5, 5, 5, 5, 5,11, 5, 5, 5, 5,13,20},
  { 3, 5, 5, 5,18, 5,11, 5, 7, 8, 8,16, 5,15, 9, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7,
   16, 5,15, 8, 8, 9, 5,11, 5,18, 5, 5, 5, 6},
  { 3, 5,18, 5,11, 5,17, 5,11, 5, 5, 5, 5, 5,11, 5, 5, 5,18,12,18, 5, 5, 5,11,
    5, 5, 5, 5, 5,11, 5,17, 5,11, 5,18, 5, 6},
  { 3, 5,11, 5,11, 5, 5, 5,11, 5,15, 8, 8, 8,14, 5,15, 8,14,12,13, 8,16, 5,13,
    8, 8, 8,16, 5,11, 5, 5, 5,11, 5,11, 5, 6},
  {17, 5,17, 5,13, 8,16, 5,11, 5, 5, 5, 5, 5, 5, 5, 5,12,12,12,12,12, 5, 5, 5,
    5, 5, 5, 5, 5,11, 5,15, 8,14, 5,17, 5,17},
  {12, 5, 5, 5, 5, 5, 5, 5, 6,10, 9, 5, 7,10,10, 9, 5,15, 8, 8, 8,16, 5, 7,10,
   10, 9, 5, 7,10, 3, 5, 5, 5, 5, 5, 5, 5,12},
  {18, 5, 7, 8, 8, 9, 5, 5,13, 1,14, 5,13, 2, 2,14, 5, 5, 5, 5, 5, 5, 5,13, 2,
    2,14, 5,13, 1,14, 5, 5, 7, 8, 8, 9, 5,18},
  { 3, 5,11,12,12,13, 9, 5, 5,17, 5, 5, 5, 5, 5, 5, 5, 7, 9, 5, 7, 9, 5, 5, 5,
    5, 5, 5, 5,17, 5, 5, 7,14,12,12,11, 5, 6},
  { 3, 5,11,12,12,12,11, 5, 5, 5, 5, 7, 8, 8, 8, 8,10, 1, 3, 5, 6, 1,10, 8, 8,
    8, 8, 9, 5, 5, 5, 5,11,12,12,12,11, 5, 6},
  { 3, 5,13, 8, 8, 8,14, 5,15, 8, 8,14, 5, 5, 5, 5,13, 2,14, 5,13, 2,14, 5, 5,
    5, 5,13, 8, 8,16, 5,13, 8, 8, 8,14, 5, 6},
  { 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 6},
  { 1,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
   10,10,10,10,10,10,10,10,10,10,10,10,10, 1}};  

.... tons and tons of code here....

void MapReset()
{
    unsigned short h,v;
    signed short Map1Data_Local[29][39] =
  {{ 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1},
  { 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 6},
  { 3, 5, 7, 8, 8, 9, 5, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,10, 8, 8, 8,10, 8, 8, 8,
    8, 8, 8, 8, 8, 8, 9, 5, 7, 8, 8, 9, 5, 6},
  { 3, 5,11,12,12,11, 5,11, 5, 5, 5, 5, 5, 5, 5, 5, 5,11,12,12,12,11, 5, 5, 5,
    5, 5, 5, 5, 5, 5,11, 5,11,12,12,11, 5, 6},
  { 3, 5,13, 8, 8,14, 5, 6, 9, 5, 5, 5, 5, 5, 5, 5, 5,13, 8, 8, 8,14, 5, 5, 5,
    5, 5, 5, 5, 5, 7, 3, 5,13, 8, 8,14, 5, 6},
  { 3, 5, 5, 5, 5, 5, 5,13,14, 5,15, 8, 8, 8, 8, 9, 5, 5, 5, 5, 5, 5, 5, 7, 8,
    8, 8, 8,16, 5,13,14, 5, 5, 5, 5, 5, 5, 6},
  { 3, 5,15, 8, 8, 9, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 8, 8,16, 5,15, 8, 8, 3, 5,
    5, 5, 5, 5, 5, 5, 5, 5, 7, 8, 8,16, 5, 6},
  { 3, 5, 5, 5, 5,13, 8, 8, 8,16, 5, 7, 8,16, 5,11, 5, 5, 5, 5, 5, 5, 5,11, 5,
   15, 8, 9, 5,15, 8, 8, 8,14, 5, 5, 5, 5, 6},
  { 3, 5, 7, 9, 5, 5, 5, 5, 5, 5, 5,11, 5, 5, 5,11, 5, 5, 7, 8, 9, 5, 5,11, 5,
    5, 5,11, 5, 5, 5, 5, 5, 5, 5, 7, 9, 5, 6},
  {17, 5, 6, 3, 5,18, 5, 7, 8, 8, 8, 3, 5,15, 8,14, 5, 7,14,12,13, 9, 5,13, 8,
   16, 5, 6, 8, 8, 8, 9, 5,18, 5, 6, 3, 5,17},
  {12, 5, 6, 3, 5,11, 5,11,12,12,12,11, 5, 5, 5, 5, 5,11,12,12,12,11, 5, 5, 5,
    5, 5,11,12,12,12,11, 5,11, 5, 6, 3, 5,12},
  {18, 5,13, 3, 5,11, 5,11,12,12,12,11, 5,15,10,16, 5,13, 8, 8, 8,14, 5,15,10,
   16, 5,11,12,12,12,11, 5,11, 5, 6,14, 5,18},
  { 3, 5, 5,11, 5,11, 5,13, 8, 8, 8,14, 5, 5,17, 5, 5, 5, 5, 5, 5, 5, 5, 5,17,
    5, 5,13, 8, 8, 8,14, 5,11, 5,11, 5, 5, 6},
  { 1, 9, 5,11, 5,11, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7,16,19,19,19,15, 9, 5, 5,
    5, 5, 5, 5, 5, 5, 5, 5,11, 5,11, 5, 7,20},
  { 1, 3, 5,11, 5,17, 5,15, 8, 8, 8,16, 5,18, 5, 5,11,12,12,12,12,12,11, 5, 5,
   18, 5,15, 8, 8, 8,16, 5,17, 5,11, 5, 6,20},
  { 1, 3, 5,11, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 9, 5,11,12,12,12,12,12,11, 5, 7,
    3, 5, 5, 5, 5, 5, 5, 5, 5, 5,11, 5, 6,20},
  { 1, 3, 5,13, 8, 8,10, 8,16, 5,15, 8, 8, 2,14, 5,11,12,12,12,12,12,11, 5,13,
    2, 8, 8,16, 5,15, 8,10, 8, 8,14, 5, 6,20},
  { 1,14, 5, 5, 5, 5,11, 5, 5, 5, 5, 5, 5, 5, 5, 5,13, 8, 8, 8, 8, 8,14, 5, 5,
    5, 5, 5, 5, 5, 5, 5,11, 5, 5, 5, 5,13,20},
  { 3, 5, 5, 5,18, 5,11, 5, 7, 8, 8,16, 5,15, 9, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7,
   16, 5,15, 8, 8, 9, 5,11, 5,18, 5, 5, 5, 6},
  { 3, 5,18, 5,11, 5,17, 5,11, 5, 5, 5, 5, 5,11, 5, 5, 5,18,12,18, 5, 5, 5,11,
    5, 5, 5, 5, 5,11, 5,17, 5,11, 5,18, 5, 6},
  { 3, 5,11, 5,11, 5, 5, 5,11, 5,15, 8, 8, 8,14, 5,15, 8,14,12,13, 8,16, 5,13,
    8, 8, 8,16, 5,11, 5, 5, 5,11, 5,11, 5, 6},
  {17, 5,17, 5,13, 8,16, 5,11, 5, 5, 5, 5, 5, 5, 5, 5,12,12,12,12,12, 5, 5, 5,
    5, 5, 5, 5, 5,11, 5,15, 8,14, 5,17, 5,17},
  {12, 5, 5, 5, 5, 5, 5, 5, 6,10, 9, 5, 7,10,10, 9, 5,15, 8, 8, 8,16, 5, 7,10,
   10, 9, 5, 7,10, 3, 5, 5, 5, 5, 5, 5, 5,12},
  {18, 5, 7, 8, 8, 9, 5, 5,13, 1,14, 5,13, 2, 2,14, 5, 5, 5, 5, 5, 5, 5,13, 2,
    2,14, 5,13, 1,14, 5, 5, 7, 8, 8, 9, 5,18},
  { 3, 5,11,12,12,13, 9, 5, 5,17, 5, 5, 5, 5, 5, 5, 5, 7, 9, 5, 7, 9, 5, 5, 5,
    5, 5, 5, 5,17, 5, 5, 7,14,12,12,11, 5, 6},
  { 3, 5,11,12,12,12,11, 5, 5, 5, 5, 7, 8, 8, 8, 8,10, 1, 3, 5, 6, 1,10, 8, 8,
    8, 8, 9, 5, 5, 5, 5,11,12,12,12,11, 5, 6},
  { 3, 5,13, 8, 8, 8,14, 5,15, 8, 8,14, 5, 5, 5, 5,13, 2,14, 5,13, 2,14, 5, 5,
    5, 5,13, 8, 8,16, 5,13, 8, 8, 8,14, 5, 6},
  { 3, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 6},
  { 1,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
   10,10,10,10,10,10,10,10,10,10,10,10,10, 1}}; 

    
    for (h=0; h<=37; h++);
    {
        for(v=0; v<=27; v++)
        {
            Map1Data[h][v] = Map1Data_Local[h][v]; // This should reset the map and pellets (NOT WORKING)
        }
    }
}

.. more code..
if (Map1Data[player1.in_tile[1]][player1.in_tile[0]] == 5)
{
    Map1Data[player1.in_tile[1]][player1.in_tile[0]] = 12;
    pellets--; // WORKING
}

Calling MapReset(); doesn't seem to work, ever. It's like the pellet code is the only thing that even has access to the main tileset aside from the renderer. If this isn't enough of the code to help, I'll post the whole source.

Last edited by Dude (2010-10-21 06:40:47)

Offline

 

#4 2010-10-22 06:35:43

mdbrim
Member

Re: Filling screen with 16x16 tiles?

Looks like you have your H and your V backwards...

It should be:

Code:

for (h=0; h<=27; h++);
{
    for(v=0; v<=37; v++);
    {
          Map1Data[h][v] = Map1Data_Local[h][v];
    }
}

or you could do:

Code:

for (h=0; h<=37; h++);
{
    for(v=0; v<=27; v++);
    {
          Map1Data[v][h] = Map1Data_Local[v][h];
    }
}

Either way should work, but you have them mixed up in yours.

Last edited by mdbrim (2010-10-22 06:42:35)

Offline

 

#5 2010-10-23 04:36:16

Dude
Member

Re: Filling screen with 16x16 tiles?

yeah I was doing that intentionally, I forget my reasoning behind it. It turns out if I nest a for loop inside of a for loop, the functionality is lost. However if I stuff the inner for loop into its own function and call it inside of a for loop from the BeginGame() function, it works fine.

Offline

 

#6 2010-10-23 20:36:28

mdbrim
Member

Re: Filling screen with 16x16 tiles?

but you that won't work...  your Map1Data is Map1Data[29][39]
so you can't have Map1Data[v][h] and have v go to 39 and h go to 29... that's gonna make it do Map1Data[39][29] not Map1Data[29][39].

wait, so it works now?

Offline

 

#7 2010-10-24 18:13:00

Dude
Member

Re: Filling screen with 16x16 tiles?

I remembered why I flipped it, it was drawing everything sideways. And yes, it does work now:

http://x-hax.cultnet.net/screenshot_03.png

Now all I have to do is program a proper collision system and some ghost objects. The pellets are actually tiles that erase themselves when you touch them.

Offline

 

#8 2010-11-18 07:45:45

Dude
Member

Re: Filling screen with 16x16 tiles?

edit: nevermind, problem solved. Does anyone know why GRRLIB might not draw partially offscreen tiles/images?

Last edited by Dude (2010-11-20 01:47:54)

Offline

 

Board footer

Powered by FluxBB