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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.