Implement appearing walls and popwalls
This commit is contained in:
parent
576a7b0c26
commit
a50de91195
12
js/main.js
12
js/main.js
@ -414,6 +414,18 @@ class Level {
|
|||||||
original_cell.is_dirty = true;
|
original_cell.is_dirty = true;
|
||||||
goal_cell.is_dirty = true;
|
goal_cell.is_dirty = true;
|
||||||
|
|
||||||
|
// Announce we're leaving, for the handful of tiles that care about it
|
||||||
|
original_cell.each(tile => {
|
||||||
|
if (tile === actor)
|
||||||
|
return;
|
||||||
|
if (actor.ignores(tile.type.name))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (tile.type.on_depart) {
|
||||||
|
tile.type.on_depart(tile, this, actor);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Step on all the tiles in the new cell
|
// Step on all the tiles in the new cell
|
||||||
if (actor === this.player) {
|
if (actor === this.player) {
|
||||||
this.hint_shown = null;
|
this.hint_shown = null;
|
||||||
|
|||||||
@ -12,8 +12,14 @@ const TILE_TYPES = {
|
|||||||
},
|
},
|
||||||
wall_appearing: {
|
wall_appearing: {
|
||||||
blocks: true,
|
blocks: true,
|
||||||
|
on_bump(me, level, other) {
|
||||||
|
me.become('wall');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
popwall: {
|
popwall: {
|
||||||
|
on_depart(me, level, other) {
|
||||||
|
me.become('wall');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
thinwall_n: {
|
thinwall_n: {
|
||||||
thin_walls: new Set(['north']),
|
thin_walls: new Set(['north']),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user