karai17 / Simple-Tiled-Implementation

Tiled library for LÖVE
Other
847 stars 121 forks source link

Box2D implementation doesn't use tile collision shapes? #272

Open dwexel opened 2 years ago

dwexel commented 2 years ago

I'm wondering if there's any way to get the box2d physics implementation to respect the tile collision shapes set in the Tiled editor. It seems like it only takes the entire tile as a square object.

Screenshot 2022-08-09 131837

For example, here in the editor you can see I've set shapes for the tiles,

Screenshot 2022-08-09 131741

But in-game, the physics objects bounce off of invisible walls. Here are my project files: lowrez-example.zip thank you, to anyone who may look.

dwexel commented 2 years ago

It normally seems as if it wouldn't be possible to do this, as STI "doesn't support tile collections."

But, you could implement tile collision shapes if you exported the tileset file from Tiled, separately and in addition to the map file, and used the tile collision info from there.

I'll update if I do more!