loadTiledMap() Function Reference

loadTiledMap(string mapfile)

Loads a Lua formatted map file exported from the Tiled tilemap editor and converts to a Qiso map. This is the easiest way to get up and running with a working map.

After exporting from Tiled to a Lua file, move that file into your assets folder and edit it, replacing the full file paths within each tilesheet block with the filenames of those sheets within your assets folder.

For large tilesheets, rather than calling enablePath() or disablePath() hundreds of times in your code, you can create custom boolean properties on tilesets within Tiled, as per the following names. loadTiledMap() will then internally enable/disable paths accordingly. Refer to the pathfindingMode() documentation for information on when to use enablePath() or disablePath()

disable-path-north
disable-path-north-east
disable-path-east
disable-path-south-east
disable-path-south
disable-path-south-west
disable-path-west
disable-path-north-west
enable-path-north
enable-path-north-east
enable-path-east
enable-path-south-east
enable-path-south
enable-path-south-west
enable-path-west
enable-path-north-west

Similarly, rather than calling keepLayerAboveCharacters() for all foreground tiles, you can create a custom boolean property on tilesets within Tiled, as per the following name, and loadTiledMap() will internally handle this for you.

keep-above-characters

Rather than calling offsetLayerFromAltitude() manually, you can add the following custom integer property on tilesets within Tiled, and loadTiledMap() will internally handle this for you.

offset-from-altitude

Rather than calling showLayerTileOnEnter() or hideLayerTileOnEnter() manually, you can add the following custom boolean properties to layers within Tiled and loadTiledMap() will internally handle this for you.

hide-tile-on-enter
show-tile-on-enter

Rather than calling showLayerOnEnter(), hideLayerOnEnter(), or opacityLayerOnEnter() manually, you can add the following custom boolean properties to layers within Tiled and loadTiledMap() will internally handle this for you.

hide-layer-on-enter
show-layer-on-enter
opacity-layer-on-enter

Be aware that layers work slightly differently in Qiso to how they work in Tiled. With Tiled, a map contains layers which contain tile sprites, where with Qiso a map contains tiles which contain layer sprites. The advantage being that you can add as many layers to a tile as you like and keep everything on a tile further towards the foreground in front of those layers. For example grass can stick up in front of a wall, despite the wall being layered above characters that are on the same tile as it. This also means that you can add new layers to a tile on the fly without having to worry about visual layering. This does however mean that some visual defects might occur when looking at a map within Tiled.

Setting a layer opacity in Tiled also sets the layers natural opacity in Qiso, so be careful when using Tiled opacities to see through layers during design. Tiled layer visibilities however, don't affect Qiso rendering.

The easiest way to understand how all of this works is to download our sample tilemap and examine the layers and tile properties that we've set up.


	local qiso = require "plugin.qisoengine"
	qiso.setAssetsFolder("assets")

	-- Load a Lua formatted Tiled Map Editor tilemap into a Qiso map.
	qiso.loadTiledMap("sample-tilemap")

	-- Enable the main Qiso loop to render/update our world
	qiso.activate()