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:
parent
a397302942
commit
70573a8ddd
|
|
@ -287,6 +287,16 @@ export default class SkipBoGame extends Phaser.Scene {
|
|||
new Button(this, 110, GAME_HEIGHT - 100, 'Leave', () => this.scene.start('GameMenu'), {
|
||||
variant: 'ghost', width: 110, height: 40, fontSize: 18,
|
||||
}).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 ───────────────────────────────────────────────────────────
|
||||
|
|
|
|||
Loading…
Reference in New Issue