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:
parent
13b9d0d1cc
commit
0c416f362b
Binary file not shown.
|
|
@ -88,7 +88,7 @@ export default class MastermindGame extends Phaser.Scene {
|
||||||
this.rightLayer = this.add.container(0, 0).setDepth(DEPTH.rows);
|
this.rightLayer = this.add.container(0, 0).setDepth(DEPTH.rows);
|
||||||
this.composeLayer = this.add.container(0, 0).setDepth(DEPTH.compose);
|
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,
|
variant: 'ghost', width: 160, height: 46, fontSize: 20,
|
||||||
}).setDepth(DEPTH.ui);
|
}).setDepth(DEPTH.ui);
|
||||||
|
|
||||||
|
|
@ -596,10 +596,14 @@ export default class MastermindGame extends Phaser.Scene {
|
||||||
this.fxLayer.add(peg);
|
this.fxLayer.add(peg);
|
||||||
pegsObjs.push(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;
|
let ticks = 0;
|
||||||
const maxTicks = 9;
|
const maxTicks = 32;
|
||||||
const ev = this.time.addEvent({
|
const ev = this.time.addEvent({
|
||||||
delay: 70, repeat: maxTicks,
|
delay: tickInterval, repeat: maxTicks,
|
||||||
callback: () => {
|
callback: () => {
|
||||||
ticks++;
|
ticks++;
|
||||||
pegsObjs.forEach((p, c) => {
|
pegsObjs.forEach((p, c) => {
|
||||||
|
|
|
||||||
|
|
@ -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-access-denied', '/assets/fx/mastermind-access-denied.mp3');
|
||||||
this.load.audio('sfx-mastermind-color', '/assets/fx/mastermind-color.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-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-roulette', '/assets/fx/roulette.mp3');
|
||||||
this.load.audio('sfx-battleship-hit', '/assets/fx/battleship-hit.mp3');
|
this.load.audio('sfx-battleship-hit', '/assets/fx/battleship-hit.mp3');
|
||||||
this.load.audio('sfx-battleship-miss', '/assets/fx/battleship-miss.mp3');
|
this.load.audio('sfx-battleship-miss', '/assets/fx/battleship-miss.mp3');
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ export const SFX = {
|
||||||
MASTERMIND_DENIED: 'sfx-mastermind-access-denied',
|
MASTERMIND_DENIED: 'sfx-mastermind-access-denied',
|
||||||
MASTERMIND_COLOR: 'sfx-mastermind-color',
|
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) {
|
export function playSound(scene, key) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue