Partly implement gray buttons; expose them and green stuff in the editor

This commit is contained in:
Eevee (Evelyn Woods) 2020-09-28 04:09:24 -06:00
parent 76051870b7
commit 325a06395d
2 changed files with 34 additions and 0 deletions

View File

@ -515,6 +515,12 @@ const EDITOR_PALETTE = [{
'bomb',
'dirt_block',
'ice_block',
'button_gray',
'button_green',
'green_floor',
'green_wall',
'green_chip',
'green_bomb',
'button_blue',
'button_red', 'cloner',
'button_brown', 'trap',

View File

@ -851,6 +851,34 @@ const TILE_TYPES = {
// TODO not implemented
draw_layer: LAYER_TERRAIN,
},
button_gray: {
// TODO only partially implemented
draw_layer: LAYER_TERRAIN,
on_arrive(me, level, other) {
level.sfx.play_once('button-press', me.cell);
for (let x = Math.max(0, me.cell.x - 2); x <= Math.min(level.width - 1, me.cell.x + 2); x++) {
for (let y = Math.max(0, me.cell.y - 2); y <= Math.min(level.height - 1, me.cell.y + 2); y++) {
let cell = level.cells[y][x];
// TODO wait is this right
if (cell === me.cell)
continue;
for (let tile of cell) {
if (tile.type.name === 'green_floor') {
tile.type = TILE_TYPES['green_wall'];
}
else if (tile.type.name === 'green_wall') {
tile.type = TILE_TYPES['green_floor'];
}
}
}
}
},
on_depart(me, level, other) {
level.sfx.play_once('button-release', me.cell);
},
},
// Time alteration
stopwatch_bonus: {