Update CRT shader vignette effect and enhance game UI with rock count display
This commit is contained in:
parent
0d1066aa2b
commit
723deab616
|
|
@ -35,7 +35,7 @@ const fragShader = `
|
||||||
color.rgb *= mix(1.0, 0.72, scanline);
|
color.rgb *= mix(1.0, 0.72, scanline);
|
||||||
|
|
||||||
// --- Vignette ---
|
// --- 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 = clamp(vig, 0.0, 1.0);
|
||||||
vig = pow(vig, 0.45);
|
vig = pow(vig, 0.45);
|
||||||
color.rgb *= vig;
|
color.rgb *= vig;
|
||||||
|
|
|
||||||
|
|
@ -94,10 +94,14 @@ export default class GameScene extends Phaser.Scene {
|
||||||
|
|
||||||
createUI() {
|
createUI() {
|
||||||
const mono = { fontFamily: 'monospace', fill: '#ffffff' };
|
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' })
|
this.levelText = this.add.text(800, 16, 'LEVEL 1', { ...mono, fontSize: '24px' })
|
||||||
.setOrigin(0.5, 0).setDepth(10);
|
.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' })
|
this.msgText = this.add.text(800, 420, '', { ...mono, fontSize: '52px', align: 'center' })
|
||||||
.setOrigin(0.5).setDepth(10).setVisible(false);
|
.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.scoreText.setText(`SCORE: ${this.score}`);
|
||||||
this.livesText.setText(`LIVES: ${this.lives}`);
|
this.livesText.setText(`LIVES: ${this.lives}`);
|
||||||
this.levelText.setText(`LEVEL ${this.level}`);
|
this.levelText.setText(`LEVEL ${this.level}`);
|
||||||
|
this.rocksText.setText(`ROCKS: ${this.asteroids.length}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
showMessage(text, autohideMs = 0) {
|
showMessage(text, autohideMs = 0) {
|
||||||
|
|
@ -328,6 +333,8 @@ export default class GameScene extends Phaser.Scene {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// small: fully destroyed – no fragments
|
// small: fully destroyed – no fragments
|
||||||
|
|
||||||
|
this.rocksText.setText(`ROCKS: ${this.asteroids.length}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Score / Game Over ────────────────────────────────────────────────────
|
// ─── Score / Game Over ────────────────────────────────────────────────────
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue