rendered paste body/** * TileWriter.js, a tile 'rendering' library for Rise or Fall * Requires: MooTools and Bija, or compatible. * * @author: Matan Lurey * @version: 1.0a */TileWriter = { init: function(element){ this.element = element; }, write: function(x, y, terrain, tile){ var xpos = (!this.last.coords) ? 0 : this.last.position[0] + (x - this.last.coords[0]) * 128; var ypos = (!this.last.coords) ? 0 : this.last.position[1] + (y - this.last.coords[1]) * 32;s this.last.coords = [x, y]; this.last.position = [xpos, ypos]; var tile = new Element('div', { styles: { left: xpos+'px', top: ypos+'px', backgroundPosition: '-'+(tile[0]*128)+'px ' + '-'+(tile[1]*64)+'px' } }).addClass(terrain).addClass((y % 2) ? 'odd' : 'even').inject(this.element); }, last: { coords: null, position: null }};