Currently working on a game, and is converting it to retina. I am using cocos2d and Tiled.
I have followed the guide on their site: Retina Display in cocos2d, but having problems with the position of objects.
What im doing right now:
NSMutableDictionary *playerSpawn = [objects objectNamed:@"SpawnPoint"];
NSAssert(playerSpawn != nil, @"Player spawn object not found");
int x = [[playerSpawn valueForKey:@"x"] intValue];
int y = [[playerSpawn valueForKey:@"y"] intValue];
self.player.position = ccp(x,y);
This sd TMX map is working just fine, but when running in Retina, the objects is not positioned correctly.
If i log the position it gives me:
// SD
158.000000, 63.000000
// Retina
158.000000, 383.000000
Ideas of what i could be doing wrong is appreciated
I found the answer.
I had to divide my retrived X an Y positions with
CC_CONTENT_SCALE_FACTOR()I also had to divide with
CC_CONTENT_SCALE_FACTOR()each time i usedtilemap.tileSize.heightandtilemap.tileSize.width.