Fix turtles and implement swivels; CC2 LESSON 1 now replays correctly!
This commit is contained in:
parent
214a430e52
commit
88ec9f89e7
@ -203,7 +203,7 @@ const TILE_ENCODING = {
|
||||
0x8a: 'thief_keys',
|
||||
// 0x8b: Ghost : '#direction', '#next'
|
||||
// 0x8c: Steel foil : '#next'
|
||||
0x8d: ['turtle', 'water'],
|
||||
0x8d: 'turtle',
|
||||
// 0x8e: Secret eye : '#next'
|
||||
// 0x8f: Thief bribe : '#next'
|
||||
// 0x90: Speed boots : '#next'
|
||||
|
||||
@ -544,7 +544,8 @@ class Level {
|
||||
if (goal_x >= 0 && goal_x < this.width && goal_y >= 0 && goal_y < this.height) {
|
||||
// Check for a thin wall in our current cell first
|
||||
for (let tile of original_cell) {
|
||||
if (tile !== actor && tile.type.thin_walls &&
|
||||
if (tile !== actor &&
|
||||
! tile.type.is_swivel && tile.type.thin_walls &&
|
||||
tile.type.thin_walls.has(direction))
|
||||
{
|
||||
blocked = true;
|
||||
|
||||
@ -189,7 +189,11 @@ export const CC2_TILESET_LAYOUT = {
|
||||
west: [[9, 12], [10, 12], [11, 12]],
|
||||
},
|
||||
foil: [12, 12],
|
||||
turtle: [13, 12], // TODO also 14 + 15 for sinking
|
||||
turtle: {
|
||||
// Turtles draw atop fake water, but don't act like water otherwise
|
||||
overlay: [13, 12], // TODO also 14 + 15 for sinking
|
||||
base: 'water',
|
||||
},
|
||||
|
||||
walker: [0, 13],
|
||||
// TODO walker animations span multiple tiles, rgh
|
||||
|
||||
@ -88,18 +88,54 @@ const TILE_TYPES = {
|
||||
swivel_ne: {
|
||||
draw_layer: LAYER_OVERLAY,
|
||||
thin_walls: new Set(['north', 'east']),
|
||||
is_swivel: true,
|
||||
on_depart(me, level, other) {
|
||||
if (other.direction === 'north') {
|
||||
level.transmute_tile(me, 'swivel_se');
|
||||
}
|
||||
else if (other.direction === 'east') {
|
||||
level.transmute_tile(me, 'swivel_nw');
|
||||
}
|
||||
},
|
||||
},
|
||||
swivel_se: {
|
||||
draw_layer: LAYER_OVERLAY,
|
||||
thin_walls: new Set(['south', 'east']),
|
||||
is_swivel: true,
|
||||
on_depart(me, level, other) {
|
||||
if (other.direction === 'south') {
|
||||
level.transmute_tile(me, 'swivel_ne');
|
||||
}
|
||||
else if (other.direction === 'east') {
|
||||
level.transmute_tile(me, 'swivel_sw');
|
||||
}
|
||||
},
|
||||
},
|
||||
swivel_sw: {
|
||||
draw_layer: LAYER_OVERLAY,
|
||||
thin_walls: new Set(['south', 'west']),
|
||||
is_swivel: true,
|
||||
on_depart(me, level, other) {
|
||||
if (other.direction === 'south') {
|
||||
level.transmute_tile(me, 'swivel_nw');
|
||||
}
|
||||
else if (other.direction === 'west') {
|
||||
level.transmute_tile(me, 'swivel_se');
|
||||
}
|
||||
},
|
||||
},
|
||||
swivel_nw: {
|
||||
draw_layer: LAYER_OVERLAY,
|
||||
thin_walls: new Set(['north', 'west']),
|
||||
is_swivel: true,
|
||||
on_depart(me, level, other) {
|
||||
if (other.direction === 'north') {
|
||||
level.transmute_tile(me, 'swivel_ne');
|
||||
}
|
||||
else if (other.direction === 'west') {
|
||||
level.transmute_tile(me, 'swivel_ne');
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
// Locked doors
|
||||
@ -186,8 +222,11 @@ const TILE_TYPES = {
|
||||
},
|
||||
},
|
||||
turtle: {
|
||||
// XXX well not really because it goes on top of water??
|
||||
draw_layer: LAYER_TERRAIN,
|
||||
on_depart(me, level, other) {
|
||||
// TODO become a splash (good test: push a block on a turtle, then push again; you don't fall in water because the splash blocks you!)
|
||||
level.transmute_tile(me, 'water');
|
||||
},
|
||||
},
|
||||
ice: {
|
||||
draw_layer: LAYER_TERRAIN,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user