How to use Tilemap collision in Creator

Hi, I defined some collider in Tiled collision editor, but I can’t find way create collider in Creator, that use these collider Tiled
Can any one give me a example about it.
Thank you.

Here is my tileset

and tile map

You are using Tilemap there will be objects stored in “YourTileMap.txml” files you can name the objects in Tiled then get them from your Tilemap Variable something like this.

void PhysicsClass::ShowDebugObjects(Vector<TMXObjectGroup*> allobjectGroups)
{
log("\n****************************************");
log("**********[ Storage Count %d ]***********\n",(int)_objectGroups.size()+1);
for (const auto objectGroup : _objectGroups)
{

   // auto o = objectGroup->getObject("FOOTBALL");
    //auto o = objectGroup->getObjects();
    
 //   log ( "Object GID %s",o["type"].getDescription().c_str());
    for( auto object : objectGroup->getObjects())
    {
        auto obj = object.asValueMap();
          log ( "Object GID %s",object.getDescription().c_str());
        
         log ( "Object Groupe %s %s",objectGroup->getGroupName().c_str(),object.getDescription().c_str());
    }
}
log("\n****************************************\n");

}
then you have a choice of Box2d or Cocos collision depending on the physics you need.
once you find out how to search the objects you can pull out all the data objects… Hope this help’s

1 Like