Collisions (walls) for top-down tilemap

Hi! Importing tilemaps from Tiled works great, but there are no collisions (at least, I don’t know how to make any). Somewhere, I saw that GDevelop now supports tilemaps with collisions for platforming, but I’m making a top-down RPG-style game and placing walls manually after importing tilemap to the scene is very tedious.
Is there any way to make solid (no pass-through) surfaces within Tiled or LDtk to import them into GDevelop?

Keep in mind there is no such thing as “no passthrough” as a concept for top down behaviors in the engine.

You can designate objects, and use the “separate objects” event action to help accomplish that though.

I dont know of anything specific for top down, but if you review the tilemap page on the wiki it has guidance on importing a collision map from Tiled.

You will have to draw the collision polygon for each tile (not just use a polygon layer), so I’m not sure if that is going to be faster than just placing objects in your scene for collision, but it is an option

1 Like

@Silver-Streak I have a question about this approach, If for example there is a big area/ building that cannot be accessed, is it better to have a single big rectangle object( that act as barrier using ‘separate object event’) which is actually just a small sprite object/tiled object that is resized to become big OR it is better to use smaller square at each corner? Assuming the area/building is just a simple square.
Is there a difference in terms of performance?

In all of my examples/games with collision objects, I start with a small 8x8 sprite object that I stretch to whatever size I need for that specific collision. I only use another object if I need a very specialized shape I cannot stretch the square to.

I’d say just make the walls that are actually “touchable” by the player collision, but if all 4 sides are in reach of the player, a huge square is fine.

1 Like