diff --git a/frontend/src/js/fight_scene.ts b/frontend/src/js/fight_scene.ts index 63f33e33725bc4bb91211ff660316a1b17fcd185..e26e475880361603067ef7948052d2da97329276 100644 --- a/frontend/src/js/fight_scene.ts +++ b/frontend/src/js/fight_scene.ts @@ -224,11 +224,17 @@ export default class FightScene extends Phaser.Scene { checkAlive() { if (this.health > 0) return; + this.endGame(); + } + + async endGame() { + this.beGame = ( + await backend.updateGame(this.beGame.id, { + began_at: this.beGame.began_at, // TODO: make this optional in the type + ended_at: new Date().toISOString(), + }) + ).data; this.foes.forEach((foe) => foe.destroy()); - // this.scene.transition({ - // target: "game_over", - // }); - // // this.scene.stop(); this.scene.start("game_over"); }