Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tesselode/cartographer
Simple Tiled map loading for LÖVE.
https://github.com/tesselode/cartographer
Last synced: 3 days ago
JSON representation
Simple Tiled map loading for LÖVE.
- Host: GitHub
- URL: https://github.com/tesselode/cartographer
- Owner: tesselode
- License: mit
- Created: 2017-12-03T06:24:02.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-11-28T07:49:03.000Z (almost 4 years ago)
- Last Synced: 2024-08-02T06:17:34.342Z (3 months ago)
- Language: Lua
- Homepage: https://tesselode.github.io/cartographer/
- Size: 287 KB
- Stars: 72
- Watchers: 3
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
- awesome-love2d - cartographer - Small Tiled map loader and drawer. (Helpers)
README
# Cartographer
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.### [Documentation](https://tesselode.github.io/cartographer/)
## Usage example
```lua
local cartographer = require 'cartographer'-- load a map
local map = cartographer.load 'path/to/exported/map.lua'
-- get a layer by name
local terrain = map.layers.terrain
-- get a tile at a position
local gid = terrain:getTileAtGridPosition(32, 32)
-- check a tile property
local solid = map:getTileProperty(gid, 'solid')function love.update(dt)
-- update animations
map:update(dt)
endfunction love.draw()
-- draw the whole map
map:draw()
-- draw an individual layer
map.layers.terrain:draw()
end```
## Installation
To use Cartographer, place cartographer.lua in your project, and then add this code to your main.lua:
```lua
cartographer = require 'cartographer' -- if your cartographer.lua is in the root directory
cartographer = 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 mapsNot 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!