Page 1 of 1

Reading tiles on map

Posted: Sat May 24, 2014 12:55 pm
by Derrik
I have a 512x512 background inited with:

Code: Select all

int id = bgInit(0, BgType_Text8bpp, BgSize_T_512x512, 28, 0);
And am then trying to get the tiles so I can write a collision system for a game.

Code: Select all

inline u16 getTile(int id, int x, int y) {
    return bgGetMapPtr(id)[y * (512 / 8) + x];
}
Although this function returns values which are in my map, it returns the wrong ones.

Re: Reading tiles on map

Posted: Sat May 24, 2014 2:00 pm
by Derrik
I figured it out, each 256x256 block is placed with inverted X and Y coordinates.