Every run gets a door out: the quit chip and the LEAVE THE MATCH? ask

"all tennis screens are missing the ability to exit the game and return to
the menu — right now I need to force close the app." A quiet x chip rides the
top-right corner of every run (the scoreboard owns the left; the desktop key
hint shifts inboard). Tapping it — or Escape on desktop — freezes the world
with the existing paused flag and asks LEAVE THE MATCH?: BACK TO THE MENU in
the menu's crimson, PLAY ON underneath. Quitting is the death path minus the
death — restartRun, refreshSplash, splash — and banks nothing: an abandoned
run never happened, statistically. Verified live both ways: PLAY ON resumes
the frozen rally, quitting lands on the splash with the chip retired.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
wuwiandClaude Fable 5 committed 2026-08-14 12:07:10 +02:00
1 parent 1facc954e2
commit 11ca935ad0
2 files changed
+46 -3

No files matched your search

+22
View File
@@ -230,6 +230,7 @@ function start(modeId = pickedMode) {
// differ by at this point: gore is the game as it always was, classic is the same tennis with the
// turn switched off, and zombie tennis is the match taking the court. Everything else about a mode
// lives in the code that reads G.classic / G.match, never here.
quitChip.hidden = false; // the door out rides every run (see the quit block below)
G.classic = modeId === 'classic';
// the difficulty rides on G like G.classic does, so a mid-run restart keeps the CPU you chose
G.diff = G.classic ? (DIFFS.find(d => d.id === pickedDiff) || DIFFS[1]) : null;
@@ -467,6 +468,7 @@ const maybeRestart = () => {
restartRun();
refreshSplash(); // the run just ended: the splash count has moved
intro.hidden = false;
quitChip.hidden = true; // the door out goes with the run it belonged to
// stats.lastRun() survives restartRun on purpose — it lives in the stats module, not on G, which
// has just been restored from PRISTINE. Consumed on read, so the prompt appears once.
const run = stats.lastRun();
@@ -476,6 +478,26 @@ const maybeRestart = () => {
cv.addEventListener('pointerdown', maybeRestart);
addEventListener('keydown', maybeRestart);
// THE DOOR OUT (Oliver: every tennis screen lacked an exit — force-closing the app was the only
// way back). The chip shows for the whole run; tapping it (or Escape on desktop) freezes the
// world and asks. Quitting is the death path minus the death: restartRun resets everything and
// nothing is banked — an abandoned run never happened, statistically.
const quitChip = document.getElementById('quit'), qAsk = document.getElementById('qAsk');
document.getElementById('qChip').addEventListener('click', () => { paused = true; qAsk.hidden = false; });
document.getElementById('qNo').addEventListener('click', () => { qAsk.hidden = true; paused = false; });
document.getElementById('qYes').addEventListener('click', () => {
qAsk.hidden = true; paused = false; quitChip.hidden = true;
restartRun();
refreshSplash();
intro.hidden = false;
go('splash');
});
addEventListener('keydown', e => {
if (e.key !== 'Escape' || !intro.hidden || quitChip.hidden) return;
qAsk.hidden = !qAsk.hidden;
paused = !qAsk.hidden;
});
// A tap on the SCOREBOARD toggles the miss-log overlay, and that is now all it does. The triple-tap
// that opened test mode has moved to the back room on the splash (see below): a cheat you can trip
// by accident mid-run is a bug, and this one sat on the one thing you tap to read the log.