Add more experimental tiles: gates and a skeleton key (also some tileset touchups)

This commit is contained in:
Eevee (Evelyn Woods) 2020-12-28 14:00:47 -07:00
parent fa47c28136
commit 1e79704f70
8 changed files with 79 additions and 66 deletions

View File

@ -1167,11 +1167,10 @@ const EDITOR_PALETTE = [{
tiles: [ tiles: [
'key_blue', 'key_red', 'key_yellow', 'key_green', 'key_blue', 'key_red', 'key_yellow', 'key_green',
'flippers', 'fire_boots', 'cleats', 'suction_boots', 'flippers', 'fire_boots', 'cleats', 'suction_boots',
'bribe', 'railroad_sign', 'hiking_boots', 'speed_boots', 'hiking_boots', 'speed_boots', 'lightning_bolt', 'railroad_sign',
'xray_eye', 'helmet', 'foil', 'lightning_bolt', 'helmet', 'foil', 'hook', 'xray_eye',
'bowling_ball', 'dynamite', 'no_sign', 'gift_bow', 'bribe', 'bowling_ball', 'dynamite', 'no_sign',
'score_10', 'score_100', 'score_1000', 'score_2x', 'score_10', 'score_100', 'score_1000', 'score_2x',
'hook',
], ],
}, { }, {
title: "Creatures", title: "Creatures",
@ -1232,7 +1231,6 @@ const EDITOR_PALETTE = [{
// - wires, wire tunnels probably a dedicated tool, placing tunnels like a tile makes no sense // - wires, wire tunnels probably a dedicated tool, placing tunnels like a tile makes no sense
// - canopy normal tile; layering problem // - canopy normal tile; layering problem
// - thin walls special rotate logic, like force floors; layering problem // - thin walls special rotate logic, like force floors; layering problem
// - light switches
// TODO should tiles that respond to wiring and/or gray buttons be highlighted, highlightable? // TODO should tiles that respond to wiring and/or gray buttons be highlighted, highlightable?
}, { }, {
title: "Logic", title: "Logic",
@ -1252,7 +1250,17 @@ const EDITOR_PALETTE = [{
'purple_floor', 'purple_floor',
'purple_wall', 'purple_wall',
'button_gray', 'button_gray',
],
}, {
title: "Experimental",
tiles: [
'circuit_block/xxx', 'circuit_block/xxx',
'gift_bow',
'skeleton_key',
'gate_red',
'gate_blue',
'gate_yellow',
'gate_green',
], ],
}]; }];

View File

@ -884,6 +884,15 @@ export const LL_TILESET_LAYOUT = Object.assign({}, CC2_TILESET_LAYOUT, {
splash_slime: [[0, 38], [1, 38], [2, 38], [3, 38]], splash_slime: [[0, 38], [1, 38], [2, 38], [3, 38]],
player1_exit: [[8, 38], [9, 38], [10, 38], [11, 38]], player1_exit: [[8, 38], [9, 38], [10, 38], [11, 38]],
player2_exit: [[12, 38], [13, 38], [14, 38], [15, 38]], player2_exit: [[12, 38], [13, 38], [14, 38], [15, 38]],
// More custom tiles
gate_red: [0, 39],
gate_blue: [1, 39],
gate_yellow: [2, 39],
gate_green: [3, 39],
skeleton_key: [4, 39],
}); });
export class Tileset { export class Tileset {

View File

@ -46,6 +46,49 @@ function blocks_leaving_thin_walls(me, actor, direction) {
return me.type.thin_walls.has(direction) && actor.type.name !== 'ghost'; return me.type.thin_walls.has(direction) && actor.type.name !== 'ghost';
} }
function _define_door(key) {
return {
draw_layer: DRAW_LAYERS.terrain,
// Doors can be opened by ice blocks, but not dirt blocks
blocks_collision: COLLISION.block_cc1,
blocks(me, level, other) {
if (other.type.name === 'ghost')
return false;
return ! (other.type.has_inventory &&
(other.has_item(key) || other.has_item('skeleton_key')));
},
on_arrive(me, level, other) {
if (level.take_key_from_actor(other, key) ||
level.take_tool_from_actor(other, 'skeleton_key'))
{
level.sfx.play_once('door', me.cell);
level.transmute_tile(me, 'floor');
}
},
};
}
function _define_gate(key) {
return {
draw_layer: DRAW_LAYERS.item,
// Doors can be opened by ice blocks, but not dirt blocks
blocks_collision: COLLISION.block_cc1,
blocks(me, level, other) {
if (other.type.name === 'ghost')
return false;
return ! (other.type.has_inventory &&
(other.has_item(key) || other.has_item('skeleton_key')));
},
on_arrive(me, level, other) {
if (level.take_key_from_actor(other, key) ||
level.take_tool_from_actor(other, 'skeleton_key'))
{
level.sfx.play_once('door', me.cell);
level.remove_tile(me);
}
},
};
}
function player_visual_state(me) { function player_visual_state(me) {
if (! me) { if (! me) {
return 'normal'; return 'normal';
@ -538,63 +581,14 @@ const TILE_TYPES = {
}, },
// Locked doors // Locked doors
door_red: { door_red: _define_door('key_red'),
draw_layer: DRAW_LAYERS.terrain, door_blue: _define_door('key_blue'),
blocks(me, level, other) { door_yellow: _define_door('key_yellow'),
if (other.type.name === 'ghost') door_green: _define_door('key_green'),
return false; gate_red: _define_gate('key_red'),
// TODO not quite sure if this one is right; there are complex interactions with monsters, e.g. most monsters can eat blue keys but can't actually use them gate_blue: _define_gate('key_blue'),
return ! (other.type.has_inventory && other.has_item('key_red')); gate_yellow: _define_gate('key_yellow'),
}, gate_green: _define_gate('key_green'),
on_arrive(me, level, other) {
if (level.take_key_from_actor(other, 'key_red')) {
level.sfx.play_once('door', me.cell);
level.transmute_tile(me, 'floor');
}
},
},
door_blue: {
draw_layer: DRAW_LAYERS.terrain,
blocks(me, level, other) {
if (other.type.name === 'ghost')
return false;
return ! (other.type.has_inventory && other.has_item('key_blue'));
},
on_arrive(me, level, other) {
if (level.take_key_from_actor(other, 'key_blue')) {
level.sfx.play_once('door', me.cell);
level.transmute_tile(me, 'floor');
}
},
},
door_yellow: {
draw_layer: DRAW_LAYERS.terrain,
blocks(me, level, other) {
if (other.type.name === 'ghost')
return false;
return ! (other.type.has_inventory && other.has_item('key_yellow'));
},
on_arrive(me, level, other) {
if (level.take_key_from_actor(other, 'key_yellow')) {
level.sfx.play_once('door', me.cell);
level.transmute_tile(me, 'floor');
}
},
},
door_green: {
draw_layer: DRAW_LAYERS.terrain,
blocks(me, level, other) {
if (other.type.name === 'ghost')
return false;
return ! (other.type.has_inventory && other.has_item('key_green'));
},
on_arrive(me, level, other) {
if (level.take_key_from_actor(other, 'key_green')) {
level.sfx.play_once('door', me.cell);
level.transmute_tile(me, 'floor');
}
},
},
// Terrain // Terrain
dirt: { dirt: {
@ -2365,28 +2359,24 @@ const TILE_TYPES = {
blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover), blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover),
}, },
foil: { foil: {
// TODO not implemented
draw_layer: DRAW_LAYERS.item, draw_layer: DRAW_LAYERS.item,
is_item: true, is_item: true,
is_tool: true, is_tool: true,
blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover), blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover),
}, },
lightning_bolt: { lightning_bolt: {
// TODO not implemented
draw_layer: DRAW_LAYERS.item, draw_layer: DRAW_LAYERS.item,
is_item: true, is_item: true,
is_tool: true, is_tool: true,
blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover), blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover),
}, },
speed_boots: { speed_boots: {
// TODO not implemented
draw_layer: DRAW_LAYERS.item, draw_layer: DRAW_LAYERS.item,
is_item: true, is_item: true,
is_tool: true, is_tool: true,
blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover), blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover),
}, },
bribe: { bribe: {
// TODO not implemented
draw_layer: DRAW_LAYERS.item, draw_layer: DRAW_LAYERS.item,
is_item: true, is_item: true,
is_tool: true, is_tool: true,
@ -2398,6 +2388,12 @@ const TILE_TYPES = {
is_tool: true, is_tool: true,
blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover), blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover),
}, },
skeleton_key: {
draw_layer: DRAW_LAYERS.item,
is_item: true,
is_tool: true,
blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover),
},
// Progression // Progression
player: { player: {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Binary file not shown.