Added real-time tracking of cumulative hull damage from collisions. **Modified: src/ship.ts** - Subscribe to shipStatus.onStatusChanged in initialize() - Filter for hull status type with negative delta (damage, not repair) - Call gameStats.recordHullDamage() with absolute value of delta - Accumulates all damage over time (e.g., 15 hits at 0.01 each = 0.15 total) The Hull Damage Taken statistic now updates in real-time on the status screen, showing cumulative damage as a percentage. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
e4fbbce2c7
commit
8fc956f112
@ -215,6 +215,14 @@ export class Ship {
|
|||||||
this._gameStats.recordAsteroidDestroyed();
|
this._gameStats.recordAsteroidDestroyed();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Subscribe to ship status changes to track hull damage
|
||||||
|
this._scoreboard.shipStatus.onStatusChanged.add((event) => {
|
||||||
|
if (event.statusType === "hull" && event.delta < 0) {
|
||||||
|
// Hull damage (delta is negative)
|
||||||
|
this._gameStats.recordHullDamage(Math.abs(event.delta));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Initialize status screen
|
// Initialize status screen
|
||||||
this._statusScreen = new StatusScreen(DefaultScene.MainScene, this._gameStats);
|
this._statusScreen = new StatusScreen(DefaultScene.MainScene, this._gameStats);
|
||||||
this._statusScreen.initialize(this._camera);
|
this._statusScreen.initialize(this._camera);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user