feat: deselect card on empty space click in SkipBo

- Add pointerdown listener to clear selectedSource and highlights when clicking empty space.
- Improves UX by allowing players to easily cancel card selection.
This commit is contained in:
Brian Fertig 2026-05-17 11:23:07 -06:00
parent a397302942
commit 70573a8ddd
1 changed files with 10 additions and 0 deletions

View File

@ -287,6 +287,16 @@ export default class SkipBoGame extends Phaser.Scene {
new Button(this, 110, GAME_HEIGHT - 100, 'Leave', () => this.scene.start('GameMenu'), { new Button(this, 110, GAME_HEIGHT - 100, 'Leave', () => this.scene.start('GameMenu'), {
variant: 'ghost', width: 110, height: 40, fontSize: 18, variant: 'ghost', width: 110, height: 40, fontSize: 18,
}).setDepth(D.ui); }).setDepth(D.ui);
// Clicking empty space deselects the current card
this.input.on('pointerdown', (pointer) => {
if (!this.selectedSource) return;
if (this.input.hitTestPointer(pointer).length === 0) {
this.selectedSource = null;
this.clearHighlights();
this.setStatus('Your turn');
}
});
} }
// ── Game start ─────────────────────────────────────────────────────────── // ── Game start ───────────────────────────────────────────────────────────