src

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

2022-10-01.html (959B)


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