Don't remove the player when stepping on a bomb; it breaks things
This commit is contained in:
parent
afa132bd4c
commit
d3dfcba63b
10
js/game.js
10
js/game.js
@ -946,7 +946,15 @@ export class Level {
|
|||||||
let current = tile.type.name;
|
let current = tile.type.name;
|
||||||
this.pending_undo.push(() => tile.type = TILE_TYPES[current]);
|
this.pending_undo.push(() => tile.type = TILE_TYPES[current]);
|
||||||
tile.type = TILE_TYPES[name];
|
tile.type = TILE_TYPES[name];
|
||||||
// TODO adjust anything else?
|
|
||||||
|
// For transmuting into an animation, set up the timer immediately
|
||||||
|
if (tile.type.ttl) {
|
||||||
|
if (! TILE_TYPES[current].is_actor) {
|
||||||
|
console.warn("Transmuting a non-actor into an animation!");
|
||||||
|
}
|
||||||
|
this._set_prop(tile, 'animation_speed', tile.type.ttl);
|
||||||
|
this._set_prop(tile, 'animation_progress', 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
give_actor(actor, name) {
|
give_actor(actor, name) {
|
||||||
|
|||||||
@ -490,6 +490,8 @@ class Player extends PrimaryView {
|
|||||||
|
|
||||||
// Redraws every frame, unless the game isn't running
|
// Redraws every frame, unless the game isn't running
|
||||||
redraw() {
|
redraw() {
|
||||||
|
// FIXME draw one more frame after losing, so we can see the player explode or whatever
|
||||||
|
// TODO for bonus points, also finish the player animation (but don't advance the game any further)
|
||||||
if (this.state !== 'playing' && this.state !== 'rewinding') {
|
if (this.state !== 'playing' && this.state !== 'rewinding') {
|
||||||
this._redraw_handle = null;
|
this._redraw_handle = null;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -291,15 +291,15 @@ const TILE_TYPES = {
|
|||||||
level.transmute_tile(other, 'player_drowned');
|
level.transmute_tile(other, 'player_drowned');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
level.remove_tile(other);
|
level.transmute_tile(other, 'splash');
|
||||||
}
|
}
|
||||||
level.spawn_animation(me.cell, 'splash');
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
turtle: {
|
turtle: {
|
||||||
draw_layer: LAYER_TERRAIN,
|
draw_layer: LAYER_TERRAIN,
|
||||||
on_depart(me, level, other) {
|
on_depart(me, level, other) {
|
||||||
level.transmute_tile(me, 'water');
|
level.transmute_tile(me, 'water');
|
||||||
|
// TODO feels like we should spawn water underneath us, then transmute ourselves into the splash?
|
||||||
level.spawn_animation(me.cell, 'splash');
|
level.spawn_animation(me.cell, 'splash');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -411,11 +411,11 @@ const TILE_TYPES = {
|
|||||||
on_arrive(me, level, other) {
|
on_arrive(me, level, other) {
|
||||||
let cell = me.cell;
|
let cell = me.cell;
|
||||||
level.remove_tile(me);
|
level.remove_tile(me);
|
||||||
level.remove_tile(other);
|
|
||||||
level.spawn_animation(cell, 'explosion');
|
|
||||||
if (other.type.is_player) {
|
if (other.type.is_player) {
|
||||||
|
// Check this /before/ we change it...
|
||||||
level.fail("watch where you step");
|
level.fail("watch where you step");
|
||||||
}
|
}
|
||||||
|
level.transmute_tile(other, 'explosion');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
thief_tools: {
|
thief_tools: {
|
||||||
@ -509,10 +509,11 @@ const TILE_TYPES = {
|
|||||||
on_arrive(me, level, other) {
|
on_arrive(me, level, other) {
|
||||||
// TODO explode
|
// TODO explode
|
||||||
level.remove_tile(me);
|
level.remove_tile(me);
|
||||||
level.remove_tile(other);
|
|
||||||
if (other.type.is_player) {
|
if (other.type.is_player) {
|
||||||
|
// Check this /before/ we change it...
|
||||||
level.fail("watch where you step");
|
level.fail("watch where you step");
|
||||||
}
|
}
|
||||||
|
level.transmute_tile(other, 'explosion');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
cloner: {
|
cloner: {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user