|
datafile problem |
Fishcake
Member #8,704
June 2007
|
ok now i just started using datafiles. working on a tile based snake.
now im out of ideas. is there a way of solving this?
|
spellcaster
Member #1,493
September 2001
|
This doesn't work because the "name" of the dat file content is a define for an index. int first_tile = TILE0; /* or TILE1, no idea if you start at 0 or 1 */ for(j=0; j < MAP_HEIGHT; j++){ for(i=0; i < MAP_WIDTH; i++){ /* This assumes that all tiles are listed one after another in the correct order */ blit( (BITMAP*)data[first_tile+map.layer[0].cell[j]<i>.id].dat, DoubleBuffer, 0, 0, i * TILE_SIZE, j * TILE_SIZE, TILE_SIZE, TILE_SIZE ); } } If this doesn't work, you can also create an array of BITMAP* and load the bitmaps using the "filename#obj_name" syntax during start-up. So have no fear, we'll find a way to get this up and running -- |
Fishcake
Member #8,704
June 2007
|
weeee, it solved the problem! thanks a lot spellcaster, and thanks for replying real fast too
|
spellcaster
Member #1,493
September 2001
|
No problem. Oh, and if you select "a problem with a specific answer" when you create a thread, you can actually mark the problem as solved and give those who helped you a virtual cookie Coders like cookies. -- |
Fishcake
Member #8,704
June 2007
|
hmm...i think i didn't select "a problem with a specific answer", coz i cant see any checkbox saying "the problem has been asnwered to my satisfication". selected the wrong one
|
spellcaster
Member #1,493
September 2001
|
No problem at all. I'll compensate by making fun of julian_boolean.. um.. I mean.. um.. never mind. -- |
julian_boolean
Member #8,201
January 2007
|
Love you too. |
|