From 788e4ec3bcbac7086f0d5b99d613b992a7c02b87 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Wed, 13 Jan 2021 23:43:54 -0700 Subject: [PATCH] Fix spacebar at the end of a level skipping the title screen for the next level --- js/main.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index d4a8e67..5fc1edb 100644 --- a/js/main.js +++ b/js/main.js @@ -588,13 +588,18 @@ class Player extends PrimaryView { } if (ev.key === ' ') { + // Don't scroll pls + ev.preventDefault(); + if (this.state === 'waiting') { // Start without moving this.set_state('playing'); + return; } else if (this.state === 'paused') { // Turns out I do this an awful lot expecting it to work, so this.set_state('playing'); + return; } else if (this.state === 'stopped') { if (this.level.state === 'success') { @@ -614,9 +619,8 @@ class Player extends PrimaryView { this.restart_level(); } } + return; } - // Don't scroll pls - ev.preventDefault(); } if (ev.key === 'z') {