Center STI Isometric Map when scaling
Posted: Tue Sep 12, 2017 8:10 pm
Hi,
Currently trying to keep my STI isometric map centered when increase the scale factor but can't quite get the math to check out.
Below is what i am doing to set my camera position (tx / ty);
This works fine for a scale factor of 1 but as i move, it almost curves. Not quiet sure what i'm missing from the calculation.
Any help greatly appreciated.
Currently trying to keep my STI isometric map centered when increase the scale factor but can't quite get the math to check out.
Below is what i am doing to set my camera position (tx / ty);
Code: Select all
-- Calculated each time the scale changes
tx = ((windowWidth - (map.width * map.tilewidth * scale)) / 2);
ty = ((windowHeight - (map.height * map.tileheight * scale)) / 2);
-- love.draw
map:draw(tx, ty, scale, scale);
Any help greatly appreciated.