Load CSS tiles for a DOM tilemap.
Checkout dom-tilemap for rendering these tiles into the DOM.
options
are:
size
Default:16
Size of each tile in pixels.prefix
Default:'tile-'
A prefix to give each CSS selector.tiles
Default:null
A set of tiles to load in at init.tilemap
Default:null
A ndarray tilemap to load in at init.
Add a new tile:
// Add a new tile named 'rock' that is a colored 'R'
var idx = tiles.add('rock', {
text: 'R',
bg: '#333',
color: '#fff',
})
Adds a tilemap based on a ndarray:
// Add a tile map and add a tile from that texture atlas
var terrain = require('isabella-texture-pack')
tiles.addTilemap(terrain)
tiles.add('dirt', {
tilemap: [0, 2]
})
Add tiles that represent the alphabet.
The index of tiles loaded.
If you would like to retrieve a tile later:
// Using dom-tilemap, set 10,10 to the rock tile
var rock = tiles.index['rock'].index
tilemap.set(10, 10, rock)
The amount of tiles that have been loaded.
The STYLE DOM element.
- 0.1.0 - initial release
Copyright (c) 2013 Kyle Robinson Young
Licensed under the MIT license.