diff options
Diffstat (limited to 'js/puzzle-dungeon/index.html')
-rw-r--r-- | js/puzzle-dungeon/index.html | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/js/puzzle-dungeon/index.html b/js/puzzle-dungeon/index.html index ee6bff4..2caa203 100644 --- a/js/puzzle-dungeon/index.html +++ b/js/puzzle-dungeon/index.html @@ -41,6 +41,7 @@ <span id="playerPosition">(0, 0)</span> </p> <canvas id="gameCanvas"></canvas> + <p id="par">Par:</p> <p id="playerInventory">Inventory: []</p> <form id="commandForm"> <textarea id="commands" rows="10" cols="30"></textarea><br> @@ -48,11 +49,17 @@ </form> <script type="module"> import { parseCommands } from './parser.js'; - import { initializeGame, resizeCanvas } from './game.js'; + import { initializeGame, resizeCanvas, player, alertGameOver, levelPar } from './game.js'; document.getElementById('commandForm').addEventListener('submit', function(event) { event.preventDefault(); + player.par = player.par + 1; + console.log(`Player command count, ${player.par}, ${levelPar}`); const commands = document.getElementById('commands').value; + if (player.par === levelPar) { + alertGameOver(); + return; + } parseCommands(commands); }); |