A runtime parser for Tiled, an open source map editor. It allows you to dynamically load your Tiled project into your GameMaker game without having to export and import rooms and re-build the game.
This allows for example:
GMTiled2 is named after lazyeye's [GMTiled] (with permission)
Supported Tiled Features
Please see Usage guide Create a Tiled project, and make sure any tilesets that you create are named the same as tileset resources in your GameMaker project. e.g. if you have a tileset called "tl_indoor_tiles"; make sure the same sprite is imported into tiled, and the tileset also named "tl_indoor_tiles". See the example.tmx file included in the asset for an example.
Add the Tiled project tmx file into your GameMaker project so that it appears as an Included File resource.
The function tiled_oneshot(tmx_file) is a one-stop shop one-shot for loading the map. Provide the path to a .tmx file as an argument, and this function will create all the necessary layers from the Tiled project.
The bottom-most layer in the .tmx file will be 100 above the current object, and each layer will be 100 higher. e.g. if the calling object is at depth 0, the bottom-most layer will be at depth -100, the next layer will be at depth -200, etc.
Any layers that share a name with layers already in the room editor will have their depths moved.
Any objects with a name that matches an object name in gamemaker will be created as an instance on that layer. Any custom variables set in Tiled will be set in the instance after the create event. built-ins can be set this way.
For more control over the loading processing, the function tiled_read(tmx_file) loads and parses the .tmx file and returns a ds_map containing all the layer data; this can later be passed to tiled_create(tiled_data) which will generate the layers. Then either use tiled_cleanup(tiled_data) to clean up the ds_map to avoid memory leaks; or use tiled_destroy(tiled_data) to unload the layers and (hopefully) return the room to its original state (maybe).
GMTiled2 uses DerpXML by Patrick
Example Dungeon Sheet tiles by Buch