src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

2022-10-01.html (901B)


      1 <!-- src="/static/media/720/maze.png" -->
      2 <p>
      3   Use the arrow keys to move <span class="purple">Theseus</span>.
      4   <br>
      5   Your goal is to reach the <span class="green">exit</span> -- or to survive as
      6   long as possible.
      7   <br>
      8   Avoid the <span class="red">Minotaur</span>, which is hunting you.
      9   <br>
     10   Press the spacebar to reveal the <span class="blue">solution</span>.
     11   <br>
     12 </p>
     13 <canvas id="maze" height="640" width="640"></canvas>
     14 <p>
     15   <span id="game-over"></span>
     16 </p>
     17 <script type="module">
     18  import Maze from '/static/js/minotaur/maze.js';
     19  import Game from '/static/js/minotaur/game.js';
     20 
     21  // Set the canvas to be 100% the width of its container.
     22  const canvas = document.getElementById('maze');
     23  canvas.style.width ='100%';
     24 
     25  // Create a new maze and game.
     26  const maze = new Maze({ canvas, side: 24 });
     27  const game = new Game({ document, maze });
     28 
     29  // Run the game.
     30  game.run();
     31 </script>