Get collision information from each tiles

(Jiehong Jiang) #1

Hi everyone. I am using cocos2d-x with tiled.

I have tried to solve this problem the whole afternoon, but failed. I want to get the collision information of the tile which is created by Tiled Collision Editor. I found I cloud access the information through objectGroup. But what I expect is using getPropertiesForGID to get that information.

This is the procedure I have thought:

  1. loop through all tiles
  2. find the GID of the current tile by getTileGIDAt
  3. get the properties( which should include the collision information) by getPropertiesForGID.
  4. use the collision information to create physics

I stuck as #3 because getPropertiesForGID returns a blank ValueMap.
I have come up with another way to solve it is that is naming all the tile in Tiled Collision Editor and find the collision information by objectGroup, but obviously, once the project gets larger I will be in the grove of naming, which is not pleasant.

(Thorbjørn Lindeijer) #2

Please check out the following libgdx issues, which are about adding support for reading collision information: