Update CRT shader vignette effect and enhance game UI with rock count display

This commit is contained in:
Brian Fertig 2026-02-21 22:00:39 -07:00
parent 0d1066aa2b
commit 723deab616
2 changed files with 10 additions and 3 deletions

View File

@ -35,7 +35,7 @@ const fragShader = `
color.rgb *= mix(1.0, 0.72, scanline);
// --- Vignette ---
float vig = 1.0 - dot(dc * 1.8, dc * 1.8);
float vig = 1.4 - dot(dc * 1.8, dc * 1.8);
vig = clamp(vig, 0.0, 1.0);
vig = pow(vig, 0.45);
color.rgb *= vig;

View File

@ -94,10 +94,14 @@ export default class GameScene extends Phaser.Scene {
createUI() {
const mono = { fontFamily: 'monospace', fill: '#ffffff' };
this.scoreText = this.add.text(16, 16, 'SCORE: 0', { ...mono, fontSize: '20px' }).setDepth(10);
this.livesText = this.add.text(16, 44, 'LIVES: 3', { ...mono, fontSize: '20px' }).setDepth(10);
this.levelText = this.add.text(800, 16, 'LEVEL 1', { ...mono, fontSize: '24px' })
.setOrigin(0.5, 0).setDepth(10);
this.scoreText = this.add.text(620, 50, 'SCORE: 0', { ...mono, fontSize: '20px' })
.setOrigin(0.5, 0).setDepth(10);
this.livesText = this.add.text(800, 50, 'LIVES: 3', { ...mono, fontSize: '20px' })
.setOrigin(0.5, 0).setDepth(10);
this.rocksText = this.add.text(980, 50, 'ROCKS: 0', { ...mono, fontSize: '20px' })
.setOrigin(0.5, 0).setDepth(10);
this.msgText = this.add.text(800, 420, '', { ...mono, fontSize: '52px', align: 'center' })
.setOrigin(0.5).setDepth(10).setVisible(false);
}
@ -106,6 +110,7 @@ export default class GameScene extends Phaser.Scene {
this.scoreText.setText(`SCORE: ${this.score}`);
this.livesText.setText(`LIVES: ${this.lives}`);
this.levelText.setText(`LEVEL ${this.level}`);
this.rocksText.setText(`ROCKS: ${this.asteroids.length}`);
}
showMessage(text, autohideMs = 0) {
@ -328,6 +333,8 @@ export default class GameScene extends Phaser.Scene {
}
}
// small: fully destroyed no fragments
this.rocksText.setText(`ROCKS: ${this.asteroids.length}`);
}
// ─── Score / Game Over ────────────────────────────────────────────────────