My First Game
<h1>My First Game</h1>

<div id='game'>
  <div>
    <button onclick='startGame()'>Start Game</button>
  </div>
  <div id='score'>Score: 0</div>
</div>

<script>
  var score = 0;

  function startGame() {
    score += 1;
    document.getElementById('score').innerHTML = 'Score: ' + score;
  }
</script>
Simple HTML Game Tutorial: Create Your First Game

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

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