Are you using box2d as physcis engine? if yes, i recommend you to apply this class: Create Box2D bodies with TMX Objects layer! Cocos2d-x 3.0
But it doesn’t work for polylines and polygon shapes. The sizes are not correct.
Read my topic for more info (lastest posts): Problems with tiled maps
I’m fighting weeks ago about this problem
Wouldn’t it be easier to use custom properties for that? In my opinion a complete physics engine is too much overhead. You can just test for collision and check the properties. I don’t have any source (because I didn’t need it), but I would do it this way. This way every object can be a blocker (also polylines and polygon shapes). It’s just an idea, but it will need more own code (or you find any existing).
It did not work
thanks for your suggestions
From my point of view, if your game uses box2d as a physics engine, collisions must be managed by box2d.
You could use custom properties for each tile, but in this way the collisions are not detected in box2d world. I think conceptually that would be wrong.
That’s right. But what if you didn’t use box2d yet? The original poster didn’t mentioned box2d.
I think if you develop a game, unless it’s very simple, a physics engine will be used. The example mentioned was with box2d but it applies to all physics engines that handle collisions
The game that is mentioned in this post is obvious that it uses collisions
if the physics engine handles collisions (that is, all physics engines ) the correct way is to handle collisions with the engine. It is my opinion.
I can code a game without any physics engine and with collisions. This game wouldn’t be “simple”, but I understand your point of view. As always, you can say: It depends…
I would never develop my own collision manager. It’s like reinventing the wheel.
yep
As i said: it depends…
Sometimes it’s way more affective to have own code, because you know what happens. I saw many tripple A company videos on YouTube and they mostly didn’t use the std::string. Don’t know if it’s because of old codebase or because of speed, but it’s a fact, that they reinvent the wheel multiple times…
And I never wrote, that you shouldn’t use box2d. I only said, that sometime a simpler solution would be better for your custom needs If box2d works for you, it’s totally fine.