From e4fbbce2c7afc14f745932e0ebf984ecb2716746 Mon Sep 17 00:00:00 2001 From: Michael Mainguy Date: Sat, 8 Nov 2025 03:53:40 -0600 Subject: [PATCH] Step 2: Track asteroids destroyed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added real-time tracking of asteroids destroyed by listening to scoreboard score events. **Modified: src/ship.ts** - Subscribe to scoreboard.onScoreObservable in initialize() - Call gameStats.recordAsteroidDestroyed() for each score event - Each score event represents one asteroid destroyed The Asteroids Destroyed statistic now updates in real-time on the status screen whenever an asteroid is destroyed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/ship.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ship.ts b/src/ship.ts index 95f0519..92d10bc 100644 --- a/src/ship.ts +++ b/src/ship.ts @@ -209,6 +209,12 @@ export class Ship { // Initialize scoreboard (it will retrieve and setup its own screen mesh) this._scoreboard.initialize(); + // Subscribe to score events to track asteroids destroyed + this._scoreboard.onScoreObservable.add((scoreEvent) => { + // Each score event represents an asteroid destroyed + this._gameStats.recordAsteroidDestroyed(); + }); + // Initialize status screen this._statusScreen = new StatusScreen(DefaultScene.MainScene, this._gameStats); this._statusScreen.initialize(this._camera);