Monogame - big Isometric map, calculation of visible tiles

by PÅ™emysl Novák   Last Updated July 17, 2017 07:13 AM

need help wit this code..

It is simple isometric map of 128px x 128px tile in 2D field [xxxx][xxxx]

problem is with my calculating need to get startx:[0] startY[0] and endX[20] endY[10] if i know screen width and screen height + camera offset like this : enter image description here (not effective for big maps)

i have this codethat calculates start x,y and end x,y

starti = (-camera.xOffset - tileWidth) / 64;
int endi = (-camera.xOffset + camera.width + tileWidth) / 64;
int startj = (-camera.yOffset - tileHeight) / 64;
int endj = (-camera.yOffset + camera.height + tileHeight) / 64;

 Point start = twoDToIso(new Point(startx,starty));
 Point end = twoDToIso(new Point(endx, endy));
 for (int i = start.X; i < end.X; i++)
                   for (int j = start.Y; j < end.Y; j++)

this does not work it will create somethong like this: enter image description here

well i does somethig but when i move and my offset is changed it just does not work at all.

really need help with this, slept only 2 hours over this :D

if anyone knows how to calculate it would be greate thank you :)

Related Questions

Tile Map on a Mesh - Unity

Updated July 20, 2015 16:05 PM

Adventure Games - When and how to start mapping?

Updated June 30, 2015 13:05 PM

Tiled - move all tiles

Updated July 02, 2015 13:05 PM

UV mapping wrong texture

Updated March 26, 2017 22:13 PM