Implement Hole and Cracked Floor
Hole: A bottomless pit. Destroys everything (except ghosts). Cracked Floor: Turns into a hole when something steps off of it (except ghosts).
This commit is contained in:
parent
1f6c86c146
commit
c27af789cb
@ -791,6 +791,14 @@ const TILE_ENCODING = {
|
|||||||
name: 'electrified_floor',
|
name: 'electrified_floor',
|
||||||
is_extension: true,
|
is_extension: true,
|
||||||
},
|
},
|
||||||
|
0xd1: {
|
||||||
|
name: 'hole',
|
||||||
|
is_extension: true,
|
||||||
|
},
|
||||||
|
0xd2: {
|
||||||
|
name: 'cracked_floor',
|
||||||
|
is_extension: true,
|
||||||
|
},
|
||||||
0xe0: {
|
0xe0: {
|
||||||
name: 'gift_bow',
|
name: 'gift_bow',
|
||||||
has_next: true,
|
has_next: true,
|
||||||
|
|||||||
@ -1605,6 +1605,8 @@ const EDITOR_PALETTE = [{
|
|||||||
'turntable_cw',
|
'turntable_cw',
|
||||||
'turntable_ccw',
|
'turntable_ccw',
|
||||||
'electrified_floor',
|
'electrified_floor',
|
||||||
|
'hole',
|
||||||
|
'cracked_floor',
|
||||||
],
|
],
|
||||||
}];
|
}];
|
||||||
|
|
||||||
@ -2207,6 +2209,14 @@ const EDITOR_TILE_DESCRIPTIONS = {
|
|||||||
name: "Electrified Floor",
|
name: "Electrified Floor",
|
||||||
desc: "Conducts power (like a blue teleporter). While powered, destroys anything not wearing lightning boots (except dirt blocks).",
|
desc: "Conducts power (like a blue teleporter). While powered, destroys anything not wearing lightning boots (except dirt blocks).",
|
||||||
},
|
},
|
||||||
|
hole: {
|
||||||
|
name: "Hole",
|
||||||
|
desc: "A bottomless pit. Destroys everything (except ghosts).",
|
||||||
|
},
|
||||||
|
cracked_floor: {
|
||||||
|
name: "Cracked Floor",
|
||||||
|
desc: "Turns into a hole when something steps off of it (except ghosts).",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const SPECIAL_PALETTE_ENTRIES = {
|
const SPECIAL_PALETTE_ENTRIES = {
|
||||||
|
|||||||
@ -97,6 +97,12 @@ const OBITUARIES = {
|
|||||||
"inadequate insulation",
|
"inadequate insulation",
|
||||||
"rode the lightning",
|
"rode the lightning",
|
||||||
],
|
],
|
||||||
|
fell: [
|
||||||
|
"some say she's still falling",
|
||||||
|
"look before you leap",
|
||||||
|
"where's my ladder",
|
||||||
|
"it's dark down here",
|
||||||
|
],
|
||||||
generic: [
|
generic: [
|
||||||
"you had a bad time",
|
"you had a bad time",
|
||||||
],
|
],
|
||||||
|
|||||||
@ -496,6 +496,7 @@ export const CC2_TILESET_LAYOUT = {
|
|||||||
burned: [1, 5],
|
burned: [1, 5],
|
||||||
exploded: [1, 5],
|
exploded: [1, 5],
|
||||||
failed: [1, 5],
|
failed: [1, 5],
|
||||||
|
fell: [5, 39],
|
||||||
},
|
},
|
||||||
// Do a quick spin I guess??
|
// Do a quick spin I guess??
|
||||||
player1_exit: [[0, 22], [8, 22], [0, 23], [8, 23]],
|
player1_exit: [[0, 22], [8, 22], [0, 23], [8, 23]],
|
||||||
@ -627,6 +628,7 @@ export const CC2_TILESET_LAYOUT = {
|
|||||||
burned: [1, 5],
|
burned: [1, 5],
|
||||||
exploded: [1, 5],
|
exploded: [1, 5],
|
||||||
failed: [1, 5],
|
failed: [1, 5],
|
||||||
|
fell: [5, 39],
|
||||||
},
|
},
|
||||||
player2_exit: [[0, 27], [8, 27], [0, 28], [8, 28]],
|
player2_exit: [[0, 27], [8, 27], [0, 28], [8, 28]],
|
||||||
fire: [
|
fire: [
|
||||||
@ -1053,6 +1055,12 @@ export const LL_TILESET_LAYOUT = Object.assign({}, CC2_TILESET_LAYOUT, {
|
|||||||
active: [[5, 41], [6, 41], [7, 41]],
|
active: [[5, 41], [6, 41], [7, 41]],
|
||||||
inactive: [4, 41],
|
inactive: [4, 41],
|
||||||
},
|
},
|
||||||
|
hole: {
|
||||||
|
__special__: 'visual-state',
|
||||||
|
north: [8, 41],
|
||||||
|
open: [9, 41],
|
||||||
|
},
|
||||||
|
cracked_floor: [11, 43],
|
||||||
});
|
});
|
||||||
|
|
||||||
export const TILESET_LAYOUTS = {
|
export const TILESET_LAYOUTS = {
|
||||||
|
|||||||
@ -172,6 +172,9 @@ function player_visual_state(me) {
|
|||||||
else if (me.fail_reason === 'electrocuted') {
|
else if (me.fail_reason === 'electrocuted') {
|
||||||
return 'burned'; //same gfx for now
|
return 'burned'; //same gfx for now
|
||||||
}
|
}
|
||||||
|
else if (me.fail_reason === 'fell') {
|
||||||
|
return 'fell';
|
||||||
|
}
|
||||||
else if (me.fail_reason) {
|
else if (me.fail_reason) {
|
||||||
return 'failed';
|
return 'failed';
|
||||||
}
|
}
|
||||||
@ -1044,6 +1047,45 @@ const TILE_TYPES = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
hole: {
|
||||||
|
layer: LAYERS.terrain,
|
||||||
|
on_begin(me, level) {
|
||||||
|
var one_north = level.cell(me.cell.x, me.cell.y - 1);
|
||||||
|
if (one_north === null || one_north.get_terrain().type.name != 'hole') {
|
||||||
|
level._set_tile_prop(me, 'visual_state', 'north');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
level._set_tile_prop(me, 'visual_state', 'open');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
on_arrive(me, level, other) {
|
||||||
|
if (other.type.is_real_player) {
|
||||||
|
level.fail('fell', me, other);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
level.transmute_tile(other, 'puff');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
visual_state(me) {
|
||||||
|
return (me && me.visual_state) ?? 'open';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cracked_floor: {
|
||||||
|
layer: LAYERS.terrain,
|
||||||
|
on_depart(me, level, other) {
|
||||||
|
level.spawn_animation(me.cell, 'puff');
|
||||||
|
level.transmute_tile(me, 'hole');
|
||||||
|
if (other === level.player) {
|
||||||
|
level.sfx.play_once('popwall', me.cell);
|
||||||
|
}
|
||||||
|
//update hole visual state
|
||||||
|
me.type.on_begin(me, level);
|
||||||
|
var one_south = level.cell(me.cell.x, me.cell.y + 1);
|
||||||
|
if (one_south !== null && one_south.get_terrain().type.name == 'hole') {
|
||||||
|
me.type.on_begin(one_south.get_terrain(), level);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
thief_tools: {
|
thief_tools: {
|
||||||
layer: LAYERS.terrain,
|
layer: LAYERS.terrain,
|
||||||
blocks_collision: COLLISION.block_cc1 | COLLISION.monster_solid,
|
blocks_collision: COLLISION.block_cc1 | COLLISION.monster_solid,
|
||||||
@ -2541,6 +2583,7 @@ const TILE_TYPES = {
|
|||||||
'force_floor_n', 'force_floor_s', 'force_floor_e', 'force_floor_w', 'force_floor_all',
|
'force_floor_n', 'force_floor_s', 'force_floor_e', 'force_floor_w', 'force_floor_all',
|
||||||
// Ghosts don't activate swivels or popwalls
|
// Ghosts don't activate swivels or popwalls
|
||||||
'popwall', 'swivel_nw', 'swivel_ne', 'swivel_se', 'swivel_sw',
|
'popwall', 'swivel_nw', 'swivel_ne', 'swivel_se', 'swivel_sw',
|
||||||
|
'hole', 'cracked_floor',
|
||||||
]),
|
]),
|
||||||
movement_speed: 4,
|
movement_speed: 4,
|
||||||
// TODO ignores /most/ walls. collision is basically completely different. has a regular inventory, except red key. good grief
|
// TODO ignores /most/ walls. collision is basically completely different. has a regular inventory, except red key. good grief
|
||||||
|
|||||||
BIN
tileset-lexy.png
BIN
tileset-lexy.png
Binary file not shown.
|
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 94 KiB |
Loading…
Reference in New Issue
Block a user