Adjust slot machine layout and fund tracking logic for improved visual alignment and game flow
This commit is contained in:
parent
2f518e5165
commit
5739a4b8b1
|
|
@ -66,7 +66,7 @@ export default class GameScene extends Phaser.Scene {
|
|||
}
|
||||
|
||||
// Title above the machine
|
||||
this.add.text(800, 150, 'VIRTUE SLOTS', {
|
||||
this.add.text(710, 150, 'VIRTUE SLOTS', {
|
||||
fontSize: '42px',
|
||||
fontFamily: 'Georgia, serif',
|
||||
color: '#ffd700',
|
||||
|
|
@ -75,7 +75,7 @@ export default class GameScene extends Phaser.Scene {
|
|||
shadow: { offsetX: 2, offsetY: 2, color: '#000', blur: 6, fill: true }
|
||||
}).setOrigin(0.5, 0.5);
|
||||
|
||||
this.add.text(800, 195, '✝ May Fortune Favor the Faithful ✝', {
|
||||
this.add.text(710, 195, '✝ May Fortune Favor the Faithful ✝', {
|
||||
fontSize: '18px',
|
||||
fontFamily: 'Georgia, serif',
|
||||
color: '#c8a87e',
|
||||
|
|
@ -83,34 +83,35 @@ export default class GameScene extends Phaser.Scene {
|
|||
}).setOrigin(0.5, 0.5);
|
||||
|
||||
// Slot machine at center of play area
|
||||
this.slotMachine = new SlotMachine(this, 800, 490);
|
||||
this.slotMachine = new SlotMachine(this, 710, 490);
|
||||
|
||||
this.winAnim = new WinAnimation();
|
||||
this.lossAnim = new LossAnimation();
|
||||
|
||||
// ── Right section: The Reckoning vials ──────────────────────────────────
|
||||
// Panel vertically centered in play area (y=100–790), with ~87px right margin
|
||||
const sectionBg = this.add.graphics();
|
||||
sectionBg.fillStyle(0x0c0620, 0.65);
|
||||
sectionBg.fillRoundedRect(1157, 138, 434, 498, 14);
|
||||
sectionBg.fillRoundedRect(1085, 202, 428, 488, 14);
|
||||
sectionBg.lineStyle(1, 0xffd700, 0.3);
|
||||
sectionBg.strokeRoundedRect(1157, 138, 434, 498, 14);
|
||||
sectionBg.strokeRoundedRect(1085, 202, 428, 488, 14);
|
||||
|
||||
this.add.text(1374, 157, 'THE RECKONING', {
|
||||
this.add.text(1299, 220, 'THE RECKONING', {
|
||||
fontSize: '13px', fontFamily: 'Georgia, serif',
|
||||
color: '#c8a87e', letterSpacing: 5,
|
||||
}).setOrigin(0.5, 0.5);
|
||||
|
||||
this.add.text(1374, 175, 'First to $2,000 wins', {
|
||||
this.add.text(1299, 238, 'First to $2,000 wins', {
|
||||
fontSize: '10px', fontFamily: 'Georgia, serif', color: '#4a5a6a',
|
||||
}).setOrigin(0.5, 0.5);
|
||||
|
||||
this.add.text(1374, 378, 'VS', {
|
||||
this.add.text(1295, 443, 'VS', {
|
||||
fontSize: '20px', fontFamily: 'Georgia, serif', fontStyle: 'bold',
|
||||
color: '#2a1a4a', stroke: '#000000', strokeThickness: 3,
|
||||
}).setOrigin(0.5, 0.5);
|
||||
|
||||
this.lordVial = new VialDisplay(this, 1268, 190, 'The Lord', 0xffd700, 0xc8a87e);
|
||||
this.sinVial = new VialDisplay(this, 1478, 190, 'Sin', 0xff4444, 0xff6666);
|
||||
this.lordVial = new VialDisplay(this, 1193, 258, 'The Lord', 0xffd700, 0xc8a87e);
|
||||
this.sinVial = new VialDisplay(this, 1398, 258, 'Sin', 0xff4444, 0xff6666);
|
||||
|
||||
// Keyboard: Space to spin
|
||||
this.input.keyboard.on('keydown-SPACE', () => this._triggerSpin());
|
||||
|
|
@ -138,11 +139,8 @@ export default class GameScene extends Phaser.Scene {
|
|||
if (win) {
|
||||
const playerGain = Math.round(payout * 0.6);
|
||||
const lordGain = payout - playerGain;
|
||||
GameState.playerFunds += playerGain;
|
||||
GameState.lordFunds += lordGain;
|
||||
|
||||
this.game.events.emit('win', { playerGain, lordGain, symbol: symbols[0] });
|
||||
this.game.events.emit('funds-updated');
|
||||
|
||||
// Resolve UI box positions from UIScene
|
||||
const uiScene = this.scene.get('UIScene');
|
||||
|
|
@ -157,6 +155,9 @@ export default class GameScene extends Phaser.Scene {
|
|||
lordBox,
|
||||
symbols[0],
|
||||
() => {
|
||||
GameState.playerFunds += playerGain;
|
||||
GameState.lordFunds += lordGain;
|
||||
this.game.events.emit('funds-updated');
|
||||
this.lordVial.animateUpdate(GameState.lordFunds, lordBox.x, 115, () => {
|
||||
GameState.spinning = false;
|
||||
this.game.events.emit('spin-complete');
|
||||
|
|
@ -164,20 +165,19 @@ export default class GameScene extends Phaser.Scene {
|
|||
}
|
||||
);
|
||||
} else {
|
||||
GameState.sinTotal += GameState.spinCost;
|
||||
|
||||
this.game.events.emit('loss', { sinAdded: GameState.spinCost });
|
||||
this.game.events.emit('funds-updated');
|
||||
|
||||
const uiScene = this.scene.get('UIScene');
|
||||
const sinBox = uiScene ? uiScene.getSinBoxCenter() : { x: 1333, y: 60 };
|
||||
|
||||
this.lossAnim.play(
|
||||
this,
|
||||
uiScene || this,
|
||||
this.slotMachine.getCenterX(),
|
||||
this.slotMachine.getCenterY(),
|
||||
sinBox,
|
||||
() => {
|
||||
GameState.sinTotal += GameState.spinCost;
|
||||
this.game.events.emit('funds-updated');
|
||||
this.sinVial.animateUpdate(GameState.sinTotal, sinBox.x, 115, () => {
|
||||
GameState.spinning = false;
|
||||
this.game.events.emit('spin-complete');
|
||||
|
|
|
|||
Loading…
Reference in New Issue