feat: use sprite sheet for Old Maid card rendering
- Replace custom-drawn Old Maid card with sprite frame (frame 13) - Load oldmaid-cards.png spritesheet in PreloadScene - Rename GOFISH_CARD_FRAME to OLDMAID_CARD_FRAME for clarity
This commit is contained in:
parent
2bb4d14c97
commit
57c0a55710
|
|
@ -95,7 +95,7 @@ const SUIT_COLORS = {
|
||||||
h: { fill: 0xfbe7e2, stroke: 0xc92a2a, glyph: '#c92a2a' },
|
h: { fill: 0xfbe7e2, stroke: 0xc92a2a, glyph: '#c92a2a' },
|
||||||
d: { fill: 0xfbe7e2, stroke: 0xc92a2a, glyph: '#c92a2a' },
|
d: { fill: 0xfbe7e2, stroke: 0xc92a2a, glyph: '#c92a2a' },
|
||||||
};
|
};
|
||||||
const GOFISH_CARD_FRAME = { A: 0, '2': 1, '3': 2, '4': 3, '5': 4, '6': 5, '7': 6, '8': 7, '9': 8, T: 9, J: 10, Q: 11, K: 12 };
|
const OLDMAID_CARD_FRAME = { A: 0, '2': 1, '3': 2, '4': 3, '5': 4, '6': 5, '7': 6, '8': 7, '9': 8, T: 9, J: 10, Q: 11, K: 12, OM: 13 };
|
||||||
|
|
||||||
// ── Scene ───────────────────────────────────────────────────────────────────
|
// ── Scene ───────────────────────────────────────────────────────────────────
|
||||||
export default class OldMaidGame extends Phaser.Scene {
|
export default class OldMaidGame extends Phaser.Scene {
|
||||||
|
|
@ -323,24 +323,10 @@ export default class OldMaidGame extends Phaser.Scene {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special unmatched Old Maid card — distinct custom face.
|
const frame = OLDMAID_CARD_FRAME[card.rank];
|
||||||
if (card.isOldMaid) {
|
if (frame !== undefined && this.textures.exists('oldmaid-cards')) {
|
||||||
g.fillStyle(0x2c1a3a, 1);
|
|
||||||
g.fillRoundedRect(x, y, CARD_W, CARD_H, CARD_R);
|
|
||||||
g.lineStyle(3, 0xc678dd, 1);
|
|
||||||
g.strokeRoundedRect(x + 2, y + 2, CARD_W - 4, CARD_H - 4, CARD_R - 1);
|
|
||||||
container.add(g);
|
|
||||||
container.add(this.add.text(0, -8, '👵', { fontFamily: 'sans-serif', fontSize: '52px' }).setOrigin(0.5));
|
|
||||||
container.add(this.add.text(0, y + CARD_H - 22, 'OLD MAID', {
|
|
||||||
fontFamily: 'Righteous', fontSize: '13px', color: '#e6c8ff',
|
|
||||||
}).setOrigin(0.5));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const frame = GOFISH_CARD_FRAME[card.rank];
|
|
||||||
if (frame !== undefined && this.textures.exists('gofish-cards')) {
|
|
||||||
g.destroy();
|
g.destroy();
|
||||||
container.add(this.add.image(0, 0, 'gofish-cards', frame).setDisplaySize(CARD_W, CARD_H).setOrigin(0.5));
|
container.add(this.add.image(0, 0, 'oldmaid-cards', frame).setDisplaySize(CARD_W, CARD_H).setOrigin(0.5));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ export default class PreloadScene extends Phaser.Scene {
|
||||||
this.load.spritesheet('dominion-tokens', '/assets/images/dominion-tokens.png', { frameWidth: 150, frameHeight: 150 });
|
this.load.spritesheet('dominion-tokens', '/assets/images/dominion-tokens.png', { frameWidth: 150, frameHeight: 150 });
|
||||||
this.load.spritesheet('ttr-cards', '/assets/images/tickettoride-cards.png', { frameWidth: 270, frameHeight: 390 });
|
this.load.spritesheet('ttr-cards', '/assets/images/tickettoride-cards.png', { frameWidth: 270, frameHeight: 390 });
|
||||||
this.load.spritesheet('gofish-cards', '/assets/images/gofish-cards.png', { frameWidth: 270, frameHeight: 390 });
|
this.load.spritesheet('gofish-cards', '/assets/images/gofish-cards.png', { frameWidth: 270, frameHeight: 390 });
|
||||||
|
this.load.spritesheet('oldmaid-cards', '/assets/images/oldmaid-cards.png', { frameWidth: 270, frameHeight: 390 });
|
||||||
this.load.spritesheet('tab-icons', '/assets/images/tab-icons.png', { frameWidth: 128, frameHeight: 128 });
|
this.load.spritesheet('tab-icons', '/assets/images/tab-icons.png', { frameWidth: 128, frameHeight: 128 });
|
||||||
this.load.spritesheet('game-icons', '/assets/images/game-icons.png', { frameWidth: 44, frameHeight: 44 });
|
this.load.spritesheet('game-icons', '/assets/images/game-icons.png', { frameWidth: 44, frameHeight: 44 });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue