don't allow undo onto new level
authorcassowarii <cassowarii@users.noreply.github.com>
Sun, 6 Oct 2024 23:31:45 +0000 (16:31 -0700)
committercassowarii <cassowarii@users.noreply.github.com>
Sun, 6 Oct 2024 23:31:45 +0000 (16:31 -0700)
game.js

diff --git a/game.js b/game.js
index 4a193d9..b693313 100644 (file)
--- a/game.js
+++ b/game.js
@@ -515,6 +515,7 @@ function undo() {
 }
 
 function reset() {
+    create_undo_point();
     game.start_transition(zb.transition.FADE, 300, function() {
         load_level();
     });
@@ -523,6 +524,8 @@ function reset() {
 function advance_level() {
     if (!can_continue) return;
 
+    undo_stack = [];
+
     console.log("W:", Math.max(...Object.keys(levels).map(a => parseInt(a, 10) || 0)));
 
     if (level_number + 1 > Math.max(...Object.keys(levels).map(a => parseInt(a, 10) || 0))) {