This is how they look when placed:

Using the diamond raster method makes the X,Y coordinates work as normal. X=X+1 still moves you to the "right." It is the main reason I chose to stay with this method. The staggered method requires a specialized coordinate system that I didn't want to deal with.
Each tile is assigned a world XY coordinate then converted to an on-screen pixel coordinate for placing the tile on the page. The calculations for getting to Pixel XY from World XY are as follows:
plotX = (worldPoint.X * WIDTH / 2 * scale) + (WIDTH / 2 * worldPoint.Y * scale);
plotY = (worldPoint.Y * RHOMBUS_HEIGHT / 2 * scale) - (RHOMBUS_HEIGHT / 2 * worldPoint.X * scale);
The worldPoint is the location in the world. The WIDTH is the width of the ISO tile, while the RHOMBUS_HEIGHT is the height of the VISIBLE tile -- in my game, my tiles are 95x95, of that the graphical part is 95 wide, but the height of the visible graphic is only 49; thus, RHOMBUS_HEIGHT is 49. The scale value is typically 1, but I use it here just in case I want to add a zoom feature later on.
No comments:
Post a Comment