-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the LDtkParser wiki! I started writing this wiki as a more in-depth instructions on how to utilise the parser.
- Import the LDtkParser project template into Gamemaker.
- Place the
oLDtkobject within a room. - Save your LDtk file within the datafiles (Included Files) folder of your project.
- Alter global.ldtk.config to your liking.
- Call ldtk_load_file() to async load the level into the session.
- Use either ldtk_generate_world or ldtk_generate_room to finish importing from LDTK.
- Have fun!
Call ldtk_config() with your custom configuration struct to overwrite their default values found in global.__ldtk_config within the 'LDtkParser' script.
Syntax:
LDtkConfig(struct);
Note:
Checkglobal.__ldtk_configin the 'LDtkParser' script for an updated list of configuration options.
The following options are what you'll most likely require for basic usage.
| Key | Description |
|---|---|
| file | The LDtk file. |
| level_name | The level to initially load, and will attempt to load a level in this order: (LDtkLoad -> config.level_name -> current room level name) |
| room_prefix | The Room prefix that you use in Gamemaker. (Default: "r") |
| tileset_prefix | The Tileset prefix that you use in Gamemaker. (Default: "") |
| object_prefix | The Object prefix that you use in Gamemaker. (Default: "o") |
Example:
// live reload config
LDtkConfig({
file: project_directory + "datafiles\\LDtkTest.ldtk",
level_name: "LDtkTest1"
})
Finally you'll need to map the sources from LDtk to their target assets and definitions in Gamemaker.
Syntax:
LDtkMappings(struct);
Note:
Checkglobal.__ldtk_config.mappingsin the 'LDtkParser' script for a full list of mappings that can be configured.
The key defines the LDtk source variable being imported with the value being the target in Gamemaker. The following options are what you'll most likely require for basic usage.
| Key | Description |
|---|---|
| levels | ldtk_level_name -> gm_room_name |
| layers | ldtk_layer_name -> gm_room_layer_name |
| enums | ldtk_enum_name -> { ldtk_enum_value -> gml_value } |
| tilesets | ldtk_tileset_name -> gm_tileset_name |
| intgrids | ldtk_intgrid_layer_name -> global.ldtk_intgrids' key |
Example:
LDtkMappings({
layers: {
Tiles: "PlaceholderTiles", // now "Tiles" layer in LDtk = "PlaceholderTiles" layer in GM
},
enums: {
TestEnum: {
//First: "First", // first is undefined, should just return the name
Second: "This is second",
Third: 3
}
},
tilesets: {
PlaceholderTiles: "tTiles",
}
});