Refinements to bulitin games

All: settings persistence
All: pause on menu
Flappy: both swipe directions trigger flaps
Freecell: skip irrelevant locations
Blocks: Lower speed/difficulty
Pinball: remove the half-implemented Nudge gesture.
This commit is contained in:
James Babcock committed 2026-09-12 23:50:23 -07:00
1 parent 937c73d81b
commit c9e95a3f69
12 files changed
+317 -108

No files matched your search

+2 -1
View File
@@ -38,13 +38,14 @@ module.exports = function worker() {
'../../native/active-display': {},
'../../native/settings-store': { getStringSetting: () => highScore, setStringSetting: (_, value) => { highScore = value; } },
'../../ui/sound-effects': {},
'../../ui/sound-setting': { loadSoundEnabled: () => true, saveSoundEnabled: () => {} },
'../../ui/window-menu': { WindowMenu: class { open() {} } },
'../../ui/gestures': { directionalFallback: (event) => event, GESTURE_CLICK: '●', GESTURE_DOUBLE_CLICK: '●●', GESTURE_SCROLL: '↕', GESTURE_LONG_PRESS: '—' },
'../../util/numeric-util': { clamp: (v, lo, hi) => Math.max(lo, Math.min(hi, v)) },
}, `
renderAndSubmit = () => {};
playSfx = () => {};
exports.api = { windows, launchBall, ballDrained, stepPhysics, tick, flip, nudge,
exports.api = { windows, launchBall, ballDrained, stepPhysics, tick, flip,
checkTargets, checkRollovers, collideBumpers, resetGame, paintContent, TARGETS, ROLLOVERS };
`, { global, Date: { now: () => now }, setInterval: () => 1, clearInterval: noop }).api;
const message = (data) => global.onmessage({ data });
-16
View File
@@ -78,22 +78,6 @@ test('ball saver preserves objectives once, then a drain pays multiplied bonus a
assert.equal(h.w.ballSaveRemaining, 8);
});
test('tilt disables awards, objective progress, saver and drain bonus', () => {
const h = worker();
h.launchBall(h.w); target(h, 0);
h.nudge(h.w); h.nudge(h.w); h.nudge(h.w);
assert.equal(h.w.tilted, true);
lane(h, 0); target(h, 1);
h.w.ballX = 121; h.w.ballY = 110; h.collideBumpers(h.w);
assert.equal(h.w.score, 150);
assert.equal(h.w.targetsDown[1], false);
assert.ok(h.w.rolloverLit.every((value) => !value));
h.ballDrained(h.w);
assert.equal(h.w.ballsLeft, 2);
assert.equal(h.w.lastBonus, 0);
assert.equal(h.w.score, 150);
});
test('pause, background, screen-off and menus preserve gameplay timers', () => {
for (const suspend of [
(h) => h.input('double-click'),
+1
View File
@@ -51,6 +51,7 @@ function worker() {
'../../native/active-display': {},
'../../native/settings-store': { getStringSetting: () => '0', setStringSetting: noop },
'../../ui/sound-effects': {}, '../../ui/window-menu': {},
'../../ui/sound-setting': { loadSoundEnabled: () => true, saveSoundEnabled: noop },
'../../ui/gestures': { directionalFallback: (event) => event },
'../../util/numeric-util': { clamp: (v, lo, hi) => Math.max(lo, Math.min(hi, v)) },
};