@erikyuzwa/rogue-punk
Version:
a JavaScript library to help you build your roguelike adventures
33 lines (32 loc) • 746 B
JavaScript
import { Glyph } from './Glyph';
export class Tile extends Glyph {
constructor(options) {
super(options);
this.walkable = options.walkable || false;
this.diggable = options.diggable || false;
this.description = options.description || '';
}
isWalkable() {
return this.walkable;
}
isDiggable() {
return this.diggable;
}
toString() {
return this.description;
}
}
export const nullTile = new Tile({
description: '(nil)'
});
export const floorTile = new Tile({
character: '.',
walkable: true,
description: 'floor'
});
export const wallTile = new Tile({
character: '#',
fgColor: '#a2a427',
diggable: true,
description: 'a wall'
});