GithubHelp home page GithubHelp logo

tmx-tools's Introduction

TmxTools

TmxTools is a set of tools to help you work with TileMaps. Particularly with those with a .tmx format. It is written entirely in JavaScript, and can be used as a Node.js module or as a command line utility.

Turning a bitmap into a TileMap

One of the most basic functions of the TmxTools is to convert bitmap images to TileMaps. The underlying idea is to provide the user with a means to develop a TileMap in whatever drawing program of his choice, and then slice and dice that bitmap and turn it into a TileMap. As if the user had created the different Tiles by hand, and then crafted a Tile Map using them.

You can get a better idea of how this works, by looking at the examples folder of this project. The simple folder under this directory contains a source image, that would act as the input to the TmxTools, and a generated .tmx file.

a sample input bitmap

An input bitmap

and its corresponding Tile Set

An output TileSet

... and this is how tiles are used to construct a TileMap with that image

A TileMap for the bitmap

Running

node src/index.js -s 64 -i ./examples/simple/test.png -o ./examples/simple/test.tmx

Options

TmxTools supports several options when run from the command line.

  • -i The path to the input bitmap we would like to turn into a TileMap [required]
  • -o The path to the output .tmx file where we would like to write our generated TileMap [required]
  • -s Tile Size in pixels. Tiles are always squared, with a non zero, positive, power of two size.
    • 64 [default]
  • -z Compression Algorithm.
    • gzip [default]
    • zlib
    • none

Building

TmxTools makes use of several Node.js modules, which you will need to have downloaded locally, before it can work its magic. The required modules are listed in the package.json file, as in any classic Node.js application. In order to download all required packages, go to your terminal window and type:

npm install

The project also has JsDoc documentation. In order to generate it, type:

npm run docs

Running the Tests

TmxTools comes with a set of Unit Tests that use Mocha.js, Chai.js, etc. In order to run them, simply type:

npm test

To also display test coverage information, run:

npm run coverage

Inspiration

TmxTools was first inspired by another OpenSource project, Image2Map.py

tmx-tools's People

Contributors

jisfy avatar

Stargazers

Andrei Pechkurov avatar

Watchers

James Cloos avatar  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.