0.0.3 • Published 8 years ago

tileset-processor v0.0.3

Weekly downloads
3
License
GPL-3.0
Repository
github
Last release
8 years ago

tileset-processor

Simple Node.JS module to pre-process a tileset and generate the code to use it anywhere.

Install

npm install tileset-processor --save-dev

IMPORTANT NOTE

Only .png tileset supported at the moment.

How to use

Create a simple .js file in your node.js proyect.

Add the following code:

var parser = require('tileset-processor')

parser.set('tileset', './tileset.png') //The relative tileset path
parser.set('tile-width', 16) // Tile width (in pixels)
parser.set('tile-height', 16) // Tile height (in pixels)
parser.set('tiles-width', 8) // Number of tiles horizontal in the tileset
parser.set('tiles-height', 16) // Number of tiles vertically in the tileset
parser.set('output-mode', 'css-only') // Output mode
parser.set('output-dir', './build') // Output directory

parser.generate() // Run it!

Run it width:

node yourfile.js

For now on, in base of the output-mode you should use it in a way or other.

Output modes

Currently there are only an output mode implemented.

  • css-only Generates a CSS file and copies the tileset to build dir.

    In your HTML, link the style

    <link href="build/tileset.css" rel="stylesheet" type="text/css">

    And then use it this way:

    <div class="tile t1-1"></div>