feat(mastermind): improve UI layout and enhance peg reveal animation

- Relocate Leave button to the bottom of the game screen
- Extend peg reveal animation duration to 2.3s with smoother tick timing
- Introduce MASTERMIND_CALCULATE sound effect to play during the reveal
- Update audio preload and SFX registry to support the new sound
This commit is contained in:
Brian Fertig 2026-05-31 10:19:42 -06:00
parent 13b9d0d1cc
commit 0c416f362b
4 changed files with 10 additions and 4 deletions

Binary file not shown.

View File

@ -88,7 +88,7 @@ export default class MastermindGame extends Phaser.Scene {
this.rightLayer = this.add.container(0, 0).setDepth(DEPTH.rows);
this.composeLayer = this.add.container(0, 0).setDepth(DEPTH.compose);
new Button(this, GAME_WIDTH - 120, 60, 'Leave', () => this.scene.start('GameMenu'), {
new Button(this, GAME_WIDTH - 120, GAME_HEIGHT - 60, 'Leave', () => this.scene.start('GameMenu'), {
variant: 'ghost', width: 160, height: 46, fontSize: 20,
}).setDepth(DEPTH.ui);
@ -596,10 +596,14 @@ export default class MastermindGame extends Phaser.Scene {
this.fxLayer.add(peg);
pegsObjs.push(peg);
}
// 2.3 seconds total: 32 ticks at ~72ms each
const totalDuration = 2300;
const tickInterval = totalDuration / 32;
playSound(this, SFX.MASTERMIND_CALCULATE);
let ticks = 0;
const maxTicks = 9;
const maxTicks = 32;
const ev = this.time.addEvent({
delay: 70, repeat: maxTicks,
delay: tickInterval, repeat: maxTicks,
callback: () => {
ticks++;
pegsObjs.forEach((p, c) => {

View File

@ -69,6 +69,7 @@ export default class PreloadScene extends Phaser.Scene {
this.load.audio('sfx-mastermind-access-denied', '/assets/fx/mastermind-access-denied.mp3');
this.load.audio('sfx-mastermind-color', '/assets/fx/mastermind-color.mp3');
this.load.audio('sfx-mastermind-match', '/assets/fx/mastermind-match.mp3');
this.load.audio('sfx-mastermind-calculate', '/assets/fx/mastermind-calculate.mp3');
this.load.audio('sfx-roulette', '/assets/fx/roulette.mp3');
this.load.audio('sfx-battleship-hit', '/assets/fx/battleship-hit.mp3');
this.load.audio('sfx-battleship-miss', '/assets/fx/battleship-miss.mp3');

View File

@ -24,7 +24,8 @@ export const SFX = {
MASTERMIND_GRANTED: 'sfx-mastermind-access-granted',
MASTERMIND_DENIED: 'sfx-mastermind-access-denied',
MASTERMIND_COLOR: 'sfx-mastermind-color',
MASTERMIND_MATCH: 'sfx-mastermind-match',
MASTERMIND_MATCH: 'sfx-mastermind-match',
MASTERMIND_CALCULATE: 'sfx-mastermind-calculate',
};
export function playSound(scene, key) {