-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtile.js
More file actions
32 lines (29 loc) · 715 Bytes
/
Copy pathtile.js
File metadata and controls
32 lines (29 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* Attributes of tiles that don't change.
* Colours are handled in the CSS.
*/
var TileAttrs = {
floor: { walkable:true, transparent: true, c: "." },
wall: { walkable:false, transparent: false, c: "#" },
stairsup: { walkable:true, transparent: true, c: "<" }
}
function Tile(id, x, y) {
this.id = id;
this.creature = null;
this.items = new Array();
this.x = x;
this.y = y;
}
function addCreature(dungeon, tile, creature) {
dungeon.creatures.push(creature);
tile.creature = creature;
creature.x = tile.x;
creature.y = tile.y;
creature.dungeon = dungeon;
if (creature.id === "player") {
creature.fov = new FovMap(dungeon);
}
}
function addItem(dungeon, tile, item) {
tile.items.push(item);
}