Open ValeriyDP opened 10 months ago
Sorry for the late response.
Collisions can be added in the generated TileSet (found under "/tilesets/" in the folder of the LDTK file). These are preserved even when you make changes to the LDTK file/tileset (in most cases).
With the Tileset selected (and viewed in the Inspector):
Physics > Physics Layer 0
and modify the collision shape.If you want to speed things up, and assuming most of your tiles will be fully solid square collisions, Click+Drag to select multiple tiles, then press 'F' to "Reset to default tile shape" (a full square).
heya, I'm planning a large project around this plugin and wondering what those edge cases are where the collisions aren't persisted across reloads?
The plugin has seemed to handle everything I need so far so awesome work on this, its a huge time saver!
Things like modifying/deleting the physics layer or changing the tile size/padding on the tileset in LDTK would obviously break collisions. "Force Tileset Reimport" will also completely overwrite the existing tileset and remove any changes (so use it carefully).
But regular modifications like editing/resizing the tileset image should be totally fine (as long as LDTK can handle it). I can't identify all the edge cases where collisions wouldn't be persisted.
Is there any way to import a layer as collisions? I have some tiles that are used as background in one section, and as collisions in another. I have those split in LDTk as such:
and would like my player to exist between liquids layer and bg_decor_auto layer, while still colliding with collisions. right now i'm not seeing a way of handing individual layers other than maybe post-import?
previously i'd been getting around it by exporting to Tiled, and on import from Tiled, running this bit of code:
Neat! In the docs you mention
While it is possible to add tileset collisions via a post-import script
How can one do this?
EDIT: found an example here https://github.com/afk-mario/amano-ldtk-importer/blob/main/addons/amano-ldtk-importer/examples/post-import-scripts/post-import-tileset-add-collisions-by-enum.gd
Hi I'm pretty new in the Godot and LDtk i could not get how to import a collision? I successfully imported ldtk file, it has 2 layers but do not have any mentions of collisions itself.
Thank you in advance.