How to set Collision to only a partial area of a tile?

I’m making some kind of Pacman clone using cocos2d-x and trying to implement collision with tilemap.

My first attempt was adding another layer called wall and paint the walls in the layer using a meta tile, then add to the meta’s tile property “collision: bool”.
My problem with that is when pacman sprite collides with one of the tiles in wall layer, even it only collides for a little bit it won’t let pacman move and I don’t want to hard-code the scale of the pacman sprite small enough for it to go through.

So, how to set the specific collision area of any tile?

Hi there, what I do is use the Tile Collision Editor to set the region of a tile that I want to use for collision testing.

1 Like

Thanks for quick reply, can you elaborate more on how you do it? You use Tile Collision Editor (I know this part) to set the region, then you normally add another layer called wall for example, then do what I did?

My apologies, yyyyaaa, but I’m not familiar with cocos2d-x so I don’t know the best way to manage collision data in your game.

However, for a Pacman clone I’d suggest not using collisions but instead have paths that your Pacdude sticks to and moves along – it’s kind of the reverse of collisions if you know what I mean. (I could see you using Polylines in Tiled to “draw” the paths, even).

1 Like

Brilliant!! it will be much cleaner this way, I’m giving it a try. Thanks man.