diff --git a/js/main-editor.js b/js/main-editor.js index 0a86713..3bbd299 100644 --- a/js/main-editor.js +++ b/js/main-editor.js @@ -1167,11 +1167,10 @@ const EDITOR_PALETTE = [{ tiles: [ 'key_blue', 'key_red', 'key_yellow', 'key_green', 'flippers', 'fire_boots', 'cleats', 'suction_boots', - 'bribe', 'railroad_sign', 'hiking_boots', 'speed_boots', - 'xray_eye', 'helmet', 'foil', 'lightning_bolt', - 'bowling_ball', 'dynamite', 'no_sign', 'gift_bow', + 'hiking_boots', 'speed_boots', 'lightning_bolt', 'railroad_sign', + 'helmet', 'foil', 'hook', 'xray_eye', + 'bribe', 'bowling_ball', 'dynamite', 'no_sign', 'score_10', 'score_100', 'score_1000', 'score_2x', - 'hook', ], }, { title: "Creatures", @@ -1232,7 +1231,6 @@ const EDITOR_PALETTE = [{ // - wires, wire tunnels probably a dedicated tool, placing tunnels like a tile makes no sense // - canopy normal tile; 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? }, { title: "Logic", @@ -1252,7 +1250,17 @@ const EDITOR_PALETTE = [{ 'purple_floor', 'purple_wall', 'button_gray', + ], +}, { + title: "Experimental", + tiles: [ 'circuit_block/xxx', + 'gift_bow', + 'skeleton_key', + 'gate_red', + 'gate_blue', + 'gate_yellow', + 'gate_green', ], }]; diff --git a/js/tileset.js b/js/tileset.js index 86d974c..b62eaf6 100644 --- a/js/tileset.js +++ b/js/tileset.js @@ -884,6 +884,15 @@ export const LL_TILESET_LAYOUT = Object.assign({}, CC2_TILESET_LAYOUT, { splash_slime: [[0, 38], [1, 38], [2, 38], [3, 38]], player1_exit: [[8, 38], [9, 38], [10, 38], [11, 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 { diff --git a/js/tiletypes.js b/js/tiletypes.js index 6706d5e..f352e60 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -46,6 +46,49 @@ function blocks_leaving_thin_walls(me, actor, direction) { 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) { if (! me) { return 'normal'; @@ -538,63 +581,14 @@ const TILE_TYPES = { }, // Locked doors - door_red: { - draw_layer: DRAW_LAYERS.terrain, - blocks(me, level, other) { - if (other.type.name === 'ghost') - return false; - // 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 - return ! (other.type.has_inventory && other.has_item('key_red')); - }, - 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'); - } - }, - }, + door_red: _define_door('key_red'), + door_blue: _define_door('key_blue'), + door_yellow: _define_door('key_yellow'), + door_green: _define_door('key_green'), + gate_red: _define_gate('key_red'), + gate_blue: _define_gate('key_blue'), + gate_yellow: _define_gate('key_yellow'), + gate_green: _define_gate('key_green'), // Terrain dirt: { @@ -2365,28 +2359,24 @@ const TILE_TYPES = { blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover), }, foil: { - // TODO not implemented draw_layer: DRAW_LAYERS.item, is_item: true, is_tool: true, blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover), }, lightning_bolt: { - // TODO not implemented draw_layer: DRAW_LAYERS.item, is_item: true, is_tool: true, blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover), }, speed_boots: { - // TODO not implemented draw_layer: DRAW_LAYERS.item, is_item: true, is_tool: true, blocks_collision: COLLISION.block_cc1 | (COLLISION.monster_solid & ~COLLISION.rover), }, bribe: { - // TODO not implemented draw_layer: DRAW_LAYERS.item, is_item: true, is_tool: true, @@ -2398,6 +2388,12 @@ const TILE_TYPES = { is_tool: true, 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 player: { diff --git a/tileset-lexy.png b/tileset-lexy.png index 12ec338..ea07a08 100644 Binary files a/tileset-lexy.png and b/tileset-lexy.png differ diff --git a/tileset-src/tileset-lexy-electric-floor.aseprite b/tileset-src/tileset-lexy-electric-floor.aseprite new file mode 100644 index 0000000..cf15961 Binary files /dev/null and b/tileset-src/tileset-lexy-electric-floor.aseprite differ diff --git a/tileset-src/tileset-lexy-transmogrifier.aseprite b/tileset-src/tileset-lexy-transmogrifier.aseprite index 9cdcf22..4862a94 100644 Binary files a/tileset-src/tileset-lexy-transmogrifier.aseprite and b/tileset-src/tileset-lexy-transmogrifier.aseprite differ diff --git a/tileset-src/tileset-lexy-vfx-teleport.aseprite b/tileset-src/tileset-lexy-vfx-teleport.aseprite index 3843714..9818c61 100644 Binary files a/tileset-src/tileset-lexy-vfx-teleport.aseprite and b/tileset-src/tileset-lexy-vfx-teleport.aseprite differ diff --git a/tileset-src/tileset-lexy.aseprite b/tileset-src/tileset-lexy.aseprite index 480c568..244725a 100644 Binary files a/tileset-src/tileset-lexy.aseprite and b/tileset-src/tileset-lexy.aseprite differ