<html>
  <head>
    <title>Simple HTML Game</title>
  </head>
  <body>
    <h1>My Game!</h1>
    <p>To play, click the button below.</p>
    <button onclick='startGame()'>Start Game</button>
    <script>
      let score = 0;
      const points = 10;
      const maxScore = 100;
<pre><code>  function startGame() {
    if (score &lt; maxScore) {
      score += points;
      alert('You scored ' + points + ' points! Your total score is now ' + score);
    }
    else {
      alert('You won the game!');
    }
  }
&lt;/script&gt;
</code></pre>
  </body>
</html>
Simple HTML Game: Click to Play!

原文地址: https://www.cveoy.top/t/topic/lntA 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录