Skip to content

Commit

Permalink
Make Space resume the game on the pause menu
Browse files Browse the repository at this point in the history
  • Loading branch information
erikdubbelboer committed Oct 21, 2023
1 parent 5159503 commit 2dcd93c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,18 @@ export class Game extends EventEmitter {
event.preventDefault();
break;
}
// Space resumes the game if paused, or exits if gameover.
case 'Space': {
if (this.gameover) {
this.exitHandler();
} else {
// It's a bit hacky but it works.
if (this.resumeContainer.style.display !== 'none') {
this.resumeHandler();
}
}
break;
}
}
}

Expand Down

0 comments on commit 2dcd93c

Please sign in to comment.