An importer of Tiled JSON maps for the mini-micro system.
This libary is used to load and display Tiled maps into mini-micro! Tiled is very useful to quickly create 2D tilemaps. With a few save file tweaks, one can quickly develop Tiled maps and view them in the game with a quick reload.
Due to the nature of mini-micro, there are a few limitations on what features are supported from Tiled.
minimicro-tiled is easy to use! Simply put the lib/ and res/ folder in the root of your application.
In your application:
import "lib/tiled/tiled"
Tiled = locals["lib/tiled/tiled"]
// ...
tlevel = Tiled.load("res/tilemaps/dungeon1.json", "res/tilemaps")
if tlevel.error then
print "Error loading tiled level: " + tlevel.error
return
end if
// Tiled Layer, Display layer, Tileset img index
tlevel.addRenderLayer 0 , 6 , 0
tlevel.setZoom 2
tlevel.render
Note:
load
andrender
are expensive functions. Only call them once per layer. You can callrender
again to change which image set or map data a layer is using, but it might hang the app for a sec.
There are a few features that aren't supported in mini-micro. Some might be implemented down the road.
- Map and tilemap must be saved in json format.
- Only one image (tilemap) can be used on a layer at a time.
- Tilemaps composed of individual images are not supported.
- Tile rotation is not supported.
- Object layers are not supported.
- Objects are supported as of 1/16/2024.
- Specifically tile objects. The other types haven't been tested.
- Support for custom object properties was added on 1/17/2024.
- Isometric tilesets are not supported (yet?).
- No compression/base64 support on tilemap data (yet).
- No meta data support on tiles (yet).
- While large maps can be loaded, they are progressively slower to load due to the nature of loading extremely large arrays. On a standard computer, a tiled map of 500x500 (with 250,000 tiles overall) can take about 20 - 30 seconds to load.
- Only one image can be used per display / tiled layer.
- Mini-Micro only has 7 display layers in total, so only 7 tiled layers can be used at a time.
Written with StackEdit.