Search code examples
c++cocos2d-xtiledtmxtiledmap

Cocos2d-x tilmap black screen


I am a beginner with cocos2d-x and try to use it with Tiled to create maps. I created a TileMap, and here is my code, in LevelOne::init() in level_one.cpp :

if (!CCLayer::init())
{
    return false;
}
_tileMap = new CCTMXTiledMap();
_tileMap->initWithTMXFile("levelone.tmx");
this->addChild(_tileMap);

return true;

The debugger allows me to see that the variable _tileMap contains well (at least a part) of the information in my levelone.tmx file. But when i run it, got a black screen.

Here is the project on github : https://github.com/LeopoldBriand-bot/Platformer

what would I have misunderstood? Thanks.


Solution

  • I figure it out: Tiles folder should be on th same disk than .tmx file to have relative path and both should be in Ressource folder.