Skip to content

Commit 3dced0e

Browse files
committed
Add game over hint
1 parent 8cf2936 commit 3dced0e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/game/Runner.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,12 @@ export default class Runner {
318318
this.scheduleNextUpdate();
319319
}
320320

321-
this.generationEl.innerText = `Generation #${Runner.generation} | T-Rex x ${this.tRexGroup.lives()}`;
321+
const lives = this.tRexGroup.lives();
322+
if (lives > 0) {
323+
this.generationEl.innerText = `Generation #${Runner.generation} | T-Rex x ${this.tRexGroup.lives()}`;
324+
} else {
325+
this.generationEl.innerText = 'GAME OVER';
326+
}
322327
}
323328

324329
/**

0 commit comments

Comments
 (0)