Hello,
I am making a physics 2d engine for axmol. In my first Tilemap I only had one tile set which corresponds with my collision tiles. So that tile set begins with firstgid = 1
<tileset firstgid="1" source="collision_tileset.tsx"/>
Then in my c++ code I detect which tile my sprite is one by checking the GID, which is something like this
if (metaLayer->getTileGIDAt(lowLeftCornerTileIdCoords) == 1)
// do collision
Once I had my 2d engine working I was ready to create a map with game graphics tile sets. So I have many tile sets + my previous collision tileset. When I run the game
the collisions stopped working so that when I opened my new map and I saw this:
<tileset firstgid="1" source="surface_tileset.tsx"/>
<tileset firstgid="307" source="frontFiniteParallax_imgColl.tsx"/>
<tileset firstgid="316" source="environment_imgColl.tsx"/>
<tileset firstgid="329" source="surfaceSlopes_imgColl.tsx"/>
<tileset firstgid="335" source="collision_tileset.tsx"/>
now my collision tile set id starts at 335, so no collisions are happening anymore.
My question is if I can force my collision_tileset to start at “1” in Tiled. Other wise I have to refactor the .tmx file. Or if you have any other advice, please let me know.
My collision GID tiles range is from 1 to 40. So when ever I do a new level, I want to make sure that the firstgid is assign to my collsion_tileset.
thx