Displaying Isometric tiles using Javascript.

What do you think?

well the little peice of magic code that does that is:

var isox = Math.round((this.x - this.y) * h * 0.5) + xoffset;
var isoy = Math.round((this.x + this.y) * w * 0.25) - yoffset;

The * h * 0.5 means that the isometric tile is half as height as the actual image file.

and the * w * 0.25 means the tiles must join each other by a quarter of the image size.

This formula isn’t a stagered coordinate system, its just bog standard x and y coordinates. pretty simple really.

For an exmaple of it in real world code (the screenshot) check here for update of the project http://code.google.com/p/ajaxmmo

Comments are closed.