update spirit
This commit is contained in:
@@ -36,7 +36,7 @@ export interface IPlayerState {
|
||||
export class PlayerStateMachine {
|
||||
private state: IPlayerState;
|
||||
|
||||
constructor(initialLives = 3) {
|
||||
constructor(initialLives = 1) {
|
||||
this.state = {
|
||||
color: PlayerColorState.Red,
|
||||
lives: initialLives,
|
||||
@@ -135,8 +135,11 @@ export class PlayerStateMachine {
|
||||
this.startIFrames();
|
||||
if (this.state.lives === 0) {
|
||||
this.state.isDead = true;
|
||||
return { kind: 'died', cause };
|
||||
}
|
||||
return { kind: 'died', cause };
|
||||
// Lost a life but still alive — treat as a downgrade so callers
|
||||
// can distinguish real death from a mere life-loss.
|
||||
return { kind: 'downgraded', from: this.state.color, to: PlayerColorState.Red };
|
||||
}
|
||||
|
||||
private startIFrames(): void {
|
||||
|
||||
Reference in New Issue
Block a user