0

I'm getting a bit confused here about the coordinates of an object on a Tiled isometric map. I have an isometric map that is 25x25 tiles, each tile being 32x32 pixels (64x32 isometrically). I have an object on the map positioned at 128.0 x and 64.0 y. When running this in cocos2d-x, the coordinates are coming up as 128.0 x and 704.0 y? Where is this y coordinate coming from?

I tried comparing it to different y values which is as follows:

64.0 y in Tiled = 704.0 y in cocos2d-x
128.0 y in Tiled = 640.0 y in cocos2d-x
256.0 y in Tiled = 512.0 y in cocos2d-x

I honestly cannot figure out where this y-coordinate is coming from. Any help is appreciated.

SpellChucker
  • 450
  • 5
  • 18
  • 1
    X goes from left to right as usual, but Y goes from bottom to top. – Jongware Mar 08 '15 at 14:08
  • Interesting, so why isn't it positioned that way in Tiled? Should be consistent. Thank you though! – SpellChucker Mar 08 '15 at 14:28
  • The "screen" and "isometric" coordinate spaces are different, that's all. I have written isometric code from scratch and found the same thing. See `IsometricRenderer::screenToTileCoords` and related functions in `isometricrenderer.cpp` for the exact calculations. – Jongware Mar 08 '15 at 14:38
  • I know the "screen" and "isometric" coordinates are different, but the coordinates even within Tiled are different than the properties of an object in cocos2d-x. That's where my confusion is. If you loop through the objects of a tilemap, the 'x' property of an object is the same but the 'y' property is calculated from the bottom up instead of top down like in Tiled. – SpellChucker Mar 08 '15 at 19:41

0 Answers0