levigilbert / godot-LDtk-import

Basic GDscript for importing LDtk files into the Godot game engine.
MIT License
126 stars 15 forks source link

Please note, I am no longer actively maintaining this plugin as of 04/09/2023. There are several forks of this project that are more up to date, as well as other similar plugins that are available on GitHub. I'll be leaving the project up for those that want to view the code and/or build from it, but do note that it most likely will be outdated.

Levi

godot-LDtk-import

Basic GDscript for importing LDtk files into the Godot game engine.

Updates:

7/17/2022

Can now create tilemaps from autolayers and intgrid layers with tilesets. Intgrid layers without tilesets are ignored currently.

11/12/2020:

How to use:

  1. Copy the addons folder to your godot project folder.
  2. Enable LDtk Importer under Project Settings/Plugins.
  3. Add a .ldtk map file and any spritesheets you're using to your project folder.
  4. Select your .ldtk file and open the Import menu to toggle importing collisions, custom entities, metadata, and YSort.

Tips:

Import Menu Options:

Importing Collisions:

Entities:

You can set up how your entities are imported:

  1. Create a new Entity
  2. Add a String Field Type
  3. Set the Field Identifier to: NodeType
  4. Set the Default Value to the type of Node
  5. Any fields added to the entity on LDtk can set properties on the object or be added as metadata if the option is set when importing (retrieve using the function 'get_meta()' on the object after importing).

If your entity does not have a NodeType field, it will be imported as a Node2D node and all fields will be imported as metadata. You can set up post-import scripts to handle the imported entities yourself.

Current node options are:

  1. If not using Custom Entities:

    • Position2D
    • Area2D
    • KinematicBody2D
    • RigidBody2D
    • StaticBody2D
  2. If using Custom Entities:

    • Set the Default Value to the resource path (eg: 'res://Player.tscn').

Notes: