I've been trying to make sense of the Knight Fight isometric game made wih Tiled Map Editor
This particular function is giving me different results when I opened a fresh project and loaded the same map.
-(CGPoint) locationFromTilePos:(CGPoint)tilePos;
{
CCTMXLayer *grass = [self.tileMap layerNamed:@"Grass"];
CCSprite *tile = [grass tileAt:tilePos];
float x = -tile.position.x - self.tileMap.tileSize.width + 32;
float y = -tile.position.y - self.tileMap.tileSize.height;
return CGPointMake(x, y);
}
When feeding in tilePos as (0,0) in Knight Fight
- Grass Tile position : (1248, 1248)
- Final location returned by function : (-1280,-1280)
When feeding in tilePos as (0,0) in my fresh project
- Grass Tile position : (624, 624)
- Final location returned by function : (-656,-656)
I cannot find any resource online for Isometric Maps on Cocos2d using Tiled. I need to convert between tile coordinates and real screen coordinates. Can anyone help.