You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cartographer is a small library for loading, reading, and drawing Tiled maps in LÖVE. It draws tile layers and tile objects, and it has various utilities to make parsing Tiled maps easier.
localcartographer=require'cartographer'-- load a maplocalmap=cartographer.load'path/to/exported/map.lua'-- get a layer by namelocalterrain=map.layers.terrain-- get a tile at a positionlocalgid=terrain:getTileAtGridPosition(32, 32)
-- check a tile propertylocalsolid=map:getTileProperty(gid, 'solid')
functionlove.update(dt)
-- update animationsmap:update(dt)
endfunctionlove.draw()
-- draw the whole mapmap:draw()
-- draw an individual layermap.layers.terrain:draw()
end
Installation
To use Cartographer, place cartographer.lua in your project, and then add this code to your main.lua:
cartographer=require'cartographer' -- if your cartographer.lua is in the root directorycartographer=require'path.to.cartographer' -- if it's in subfolders
Feature support
Supported:
Drawing CSV and Base64-formatted tile layers
Drawing tile objects
Animated tiles
Layer offsets
Infinite maps
Not supported:
Drawing Zstandard-compressed tile layers
Isometic and hexagonal maps
Contributing
Feel free to open issues and send pull requests. I'm open to bug fixes and new features!