Code Monkey home page Code Monkey logo

cartographer's Introduction

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.

Usage example

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)
end

function 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:

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 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!

cartographer's People

Contributors

tesselode avatar yozzaxia1311 avatar jaythomas avatar josh-perry avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.