Okay, this question coming from the self confessed "master of tile maps" is totally embarassing. I am having trouble calculating the correct offset to scroll what is for all intents and purposes a tilemap.
Its the mini map on my 3d game. The dungeons are laid out in a tile-like array which makes it easy (supposedly >>
. I know how to smooth scroll a normal tile map, generally you calculate the offset for the tile like player_x % TileSize and player_y % TileSize for the horizontal offset. But nothing I am doing seems to make my mini map scroll.. I think it has something to do with the dungeon tiles being one size and then the tiles of the minimap being another.
The size of a dungeon square is 79 units and the size of a minimap tile (not zoomed in) is 10px. I have tried
offsetx = abs(PlayerChar.x) % TS-1;
offsety = abs(PlayerChar.z) % TS-1;
and
offsetx = abs(PlayerChar.x) % TileSize-1;
offsety = abs(PlayerChar.z) % TileSize-1;
(TS is a var containing the size of a minimap tile, TileSize holds the size of a dungeon tile)
I even tried
offsetx = abs(PlayerChar.x / TS) % TS-1;
offsety = abs(PlayerChar.z / TS) % TS-1;
which actually came close but no cigar. I have natch tried them all without the -1 too. and I have tried both adding the offset and subtracting the offset from the tile locations.
Tiles are calculated as:
DrawX = dx + ((tx - 1) * TS) - offsetx;
DrawY = dy + (y * TS) - offsety;
without the offsets its a perfect adverage tile renderer that scrolls 1 tile at a time, with offset it goes all over the place :/
what have i forgotten/missed?