Getting isometric grid coordinates from standard X,Y coordinates

Posted by RoryHarvey on Game Development See other posts from Game Development or by RoryHarvey
Published on 2012-05-21T10:50:46Z Indexed on 2012/12/01 17:19 UTC
Read the original article Hit count: 267

Filed under:
|
|
|
|

I'm currently trying to add sprites to an isometric Tiled TMX map using Objects in cocos2d. The problem is the X and Y metadata from TMX object are in standard 2d format (pixels x, pixels y), instead of isometric grid X and Y format. Usually you would just divide them by the tile size, but isometric needs some sort of transform.

For example on a 64x32 isometric tilemap of size 40 tiles by 40 tiles an object at (20,21)'s coordinates come out as (640,584)

So the question really is what formula gets (20,21) from (640,584)?

© Game Development or respective owner

Related posts about math

Related posts about iphone