tmxtiledmap

Cocos2dx 3.17 TileMap Basic Sample - wrong tilecord position, object layer itmes position returned also wrong

孤街醉人 提交于 2019-12-10 11:33:27
问题 I tried cocos2d TileMap sample from here, In this tilecord returned for given player position is wrong. Here is code Point HelloWorld::tileCoordForPosition(Point position) { int x = position.x / mTileMap->getTileSize().width; int y = ((mTileMap->getMapSize().height * mTileMap->getTileSize().height) - position.y) / mTileMap->getTileSize().height; return Point(x, y); } Here is Map Screenshot Also tileCord returned is wrong. So collision is not working. I used it from sample in Ray Wenderlich

Cocos2dx 3.17 TileMap Basic Sample - wrong tilecord position, object layer itmes position returned also wrong

╄→尐↘猪︶ㄣ 提交于 2019-12-06 13:30:25
I tried cocos2d TileMap sample from here , In this tilecord returned for given player position is wrong. Here is code Point HelloWorld::tileCoordForPosition(Point position) { int x = position.x / mTileMap->getTileSize().width; int y = ((mTileMap->getMapSize().height * mTileMap->getTileSize().height) - position.y) / mTileMap->getTileSize().height; return Point(x, y); } Here is Map Screenshot Also tileCord returned is wrong. So collision is not working. I used it from sample in Ray Wenderlich site Here is full sample code https://app.box.com/s/whunv70tstwxbgzxdvxfeu080y6gwucb If anyone has time,