From 86bf90ee8945e3eeeac1cc3497e4eeff2ae72081 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Thu, 24 Dec 2020 10:18:45 -0700 Subject: [PATCH] Don't let the last player walk back out of the exit --- js/game.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/game.js b/js/game.js index 9fc1d13..010f2f6 100644 --- a/js/game.js +++ b/js/game.js @@ -1044,8 +1044,10 @@ export class Level extends LevelInterface { // If the game has already been won (or lost), don't bother with a move; it'll misalign the // player from their actual position and not accomplish anything gameplay-wise. - // (Note this is only necessary because our update order is inverted from CC2.) - if (this.state !== 'playing') + // (Note this is only necessary because our update order is inverted from CC2, and because + // we don't erase the last player when they exit.) + // TODO might not be good enough if something else tries to step on us later this tic! + if (this.state !== 'playing' || this.remaining_players <= 0) return null; // TODO player in a cloner can't move (but player in a trap can still turn)