proper hero death / respawn

This commit is contained in:
2025-10-19 02:43:32 +01:00
parent ef635f6112
commit 7e9058b2c9
2 changed files with 11 additions and 1 deletions
+2 -1
View File
@@ -2,7 +2,7 @@ import { useEffect } from "react";
import type { GameManager } from "../../src";
export const useKeyBindings = (gameManager: GameManager) => {
const { gameStatus, startGame, quitGame, keyManager } = gameManager;
const { gameStatus, renderBoard, startGame, quitGame, keyManager } = gameManager;
const { clearLog } = keyManager;
useEffect(() => {
@@ -11,6 +11,7 @@ export const useKeyBindings = (gameManager: GameManager) => {
if (ev.code === "Space") {
if (["waiting", "game-over", "game-won"].includes(gameStatus)) {
clearLog();
renderBoard();
if (gameStatus === "game-over" || gameStatus === "game-won") {
quitGame();
setTimeout(() => startGame(), 0);