Look at the demo. The comments and the code should be enough to understand.
To access the collision editor in Tiled, you have to edit the tileset, select a tile and click on the button with a circle mixed with a rectangle.
Look at the demo. The comments and the code should be enough to understand.
To access the collision editor in Tiled, you have to edit the tileset, select a tile and click on the button with a circle mixed with a rectangle.
i am not sure how efficient this way is. you will need to create hundreds of object for a simple level. each tile square will have a several objects or at least 1 object but what i do now is i create a single object for the whole floor. this make more sense if you want to have good performance in your game.
here is an example of a level of my Pixel Knight game:
i am not sure how efficient this way is. you will need to create hundreds of object for a simple level. each tile square will have a several objects or at least 1 object but what i do now is i create a single object for the whole floor. this make more sense if you want to have good performance in your game.
here is an example of a level of my Pixel Knight game:
When you design a level, it's boring to redraw the objects around the tiles at every change. You can ease your work by generating the Box2D objects automatically according to the tiles used. Hence the collision objects. But it's not optimized at all and you may suffer performance issues in some cases. That being said, Box2d is good at reducing the number of candidates for a collision thanks to its object organization in a dynamic tree, so having 1000 or 10 objects do not change the performance in a significant manner in many cases. It's the number of possible collisions that matters much.
so having 1000 or 10 objects do not change the performance in a significant manner in many cases. It's the number of possible collisions that matters much.