Add more tiles and more kinds of adjustment
This commit is contained in:
parent
ec5d9f7b12
commit
aa41336b90
@ -87,4 +87,5 @@ export const TILES_WITH_PROPS = {
|
|||||||
// TODO cloner arrows
|
// TODO cloner arrows
|
||||||
// TODO railroad parts
|
// TODO railroad parts
|
||||||
// TODO later, custom floor/wall selection
|
// TODO later, custom floor/wall selection
|
||||||
|
// TODO directional blocks
|
||||||
};
|
};
|
||||||
|
|||||||
@ -240,29 +240,39 @@ class ForceFloorOperation extends DrawOperation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tiles the "adjust" tool will turn into each other
|
// Tiles the "adjust" tool will turn into each other
|
||||||
const ADJUST_TOGGLES = {
|
const ADJUST_TOGGLES_CW = {};
|
||||||
|
const ADJUST_TOGGLES_CCW = {};
|
||||||
|
{
|
||||||
|
for (let cycle of [
|
||||||
|
['chip', 'chip_extra'],
|
||||||
// TODO shouldn't this convert regular walls into regular floors then?
|
// TODO shouldn't this convert regular walls into regular floors then?
|
||||||
floor_custom_green: 'wall_custom_green',
|
['floor_custom_green', 'wall_custom_green'],
|
||||||
floor_custom_pink: 'wall_custom_pink',
|
['floor_custom_pink', 'wall_custom_pink'],
|
||||||
floor_custom_yellow: 'wall_custom_yellow',
|
['floor_custom_yellow', 'wall_custom_yellow'],
|
||||||
floor_custom_blue: 'wall_custom_blue',
|
['floor_custom_blue', 'wall_custom_blue'],
|
||||||
wall_custom_green: 'floor_custom_green',
|
['fake_floor', 'fake_wall'],
|
||||||
wall_custom_pink: 'floor_custom_pink',
|
['popdown_floor', 'popdown_wall'],
|
||||||
wall_custom_yellow: 'floor_custom_yellow',
|
['wall_invisible', 'wall_appearing'],
|
||||||
wall_custom_blue: 'floor_custom_blue',
|
['green_floor', 'green_wall'],
|
||||||
fake_floor: 'fake_wall',
|
['green_bomb', 'green_chip'],
|
||||||
fake_wall: 'fake_floor',
|
['purple_floor', 'purple_wall'],
|
||||||
wall_invisible: 'wall_appearing',
|
['thief_keys', 'thief_tools'],
|
||||||
wall_appearing: 'wall_invisible',
|
['swivel_nw', 'swivel_ne', 'swivel_se', 'swivel_sw'],
|
||||||
green_floor: 'green_wall',
|
['ice_nw', 'ice_ne', 'ice_se', 'ice_sw'],
|
||||||
green_wall: 'green_floor',
|
['ff_north', 'ff_east', 'ff_south', 'ff_west'],
|
||||||
green_bomb: 'green_chip',
|
['ice', 'ff_all'],
|
||||||
green_chip: 'green_bomb',
|
['water', 'turtle'],
|
||||||
purple_floor: 'purple_wall',
|
['no_player1_sign', 'no_player2_sign'],
|
||||||
purple_wall: 'purple_floor',
|
['flame_jet_off', 'flame_jet_on'],
|
||||||
thief_keys: 'thief_tools',
|
])
|
||||||
thief_tools: 'thief_keys',
|
{
|
||||||
};
|
for (let [i, tile] of cycle.entries()) {
|
||||||
|
let other = cycle[(i + 1) % cycle.length];
|
||||||
|
ADJUST_TOGGLES_CW[tile] = other;
|
||||||
|
ADJUST_TOGGLES_CCW[other] = tile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
class AdjustOperation extends MouseOperation {
|
class AdjustOperation extends MouseOperation {
|
||||||
start() {
|
start() {
|
||||||
let cell = this.cell(this.gx1, this.gy1);
|
let cell = this.cell(this.gx1, this.gy1);
|
||||||
@ -277,10 +287,28 @@ class AdjustOperation extends MouseOperation {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (let tile of cell) {
|
for (let tile of cell) {
|
||||||
|
// Rotate railroads, which are a bit complicated
|
||||||
|
if (tile.type.name === 'railroad') {
|
||||||
|
let new_bits = 0;
|
||||||
|
for (let [i, new_bit] of [1, 2, 3, 0, 5, 4].entries()) {
|
||||||
|
if (tile.railroad_bits & (1 << i)) {
|
||||||
|
new_bits |= (1 << new_bit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tile.railroad_bits & 0x40) {
|
||||||
|
new_bits |= 0x40;
|
||||||
|
}
|
||||||
|
// TODO high byte also
|
||||||
|
tile.railroad_bits = new_bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO also directional blocks
|
||||||
|
|
||||||
// Toggle tiles that go in obvious pairs
|
// Toggle tiles that go in obvious pairs
|
||||||
let other = ADJUST_TOGGLES[tile.type.name];
|
let other = ADJUST_TOGGLES_CW[tile.type.name];
|
||||||
if (other) {
|
if (other) {
|
||||||
tile.type = TILE_TYPES[other];
|
tile.type = TILE_TYPES[other];
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rotate actors
|
// Rotate actors
|
||||||
@ -575,7 +603,9 @@ 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',
|
||||||
'no_sign', 'bestowal_bow',
|
'bribe', 'railroad_sign', 'hiking_boots', 'speed_boots',
|
||||||
|
'xray_eye', 'helmet', 'foil', 'lightning_bolt',
|
||||||
|
'bowling_ball', 'dynamite', 'no_sign', 'bestowal_bow',
|
||||||
],
|
],
|
||||||
}, {
|
}, {
|
||||||
title: "Creatures",
|
title: "Creatures",
|
||||||
|
|||||||
@ -906,7 +906,7 @@ main.--has-demo .demo-controls {
|
|||||||
* of overflowing flexboxes I guess, padding and margins won't extend the scroll area on the
|
* of overflowing flexboxes I guess, padding and margins won't extend the scroll area on the
|
||||||
* right and bottom */
|
* right and bottom */
|
||||||
/* TODO padding should be half a cell? */
|
/* TODO padding should be half a cell? */
|
||||||
border: 1em solid transparent;
|
border: 2em solid transparent;
|
||||||
}
|
}
|
||||||
#editor .editor-canvas canvas {
|
#editor .editor-canvas canvas {
|
||||||
display: block;
|
display: block;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user