0

Hi, I need to know how to implement scrolling on a isometric tile map I made in XNA.

Its a diamond map, drawn using this tile plotting method:

posX=(MapX-MapY)*TileWidth/2;

posY=(MapX+MapY)*TileHeight/2;


thank you

2
Contributors
1
Reply
3
Views
6 Years
Discussion Span
Last Post by TheRealOrder
0

I have not used XNA but have written many games with different kinds of maps and data structures. It looks like posX and posY are screen coordinates and MapX and MapY are map coordinates of individual tiles. To scroll your map were your view (camera) is fixed, you offset your map screen location something like this:

posX=(MapX-MapY)*TileWidth/2 + offsetX;
posY=(MapX+MapY)*TileHeight/2 + offsetY; // Please note this equation only looks right for the top half of your map

You might check the arrow keys or the mouse in a hit box at the screen edges for input and increament or decement the offsets by 5 or more screen coordinates.

If your using a stationary map and moving your view (camera) just apply the offsets to your view instead. Hope this helps, if not post more code.

Edited by TheRealOrder: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.