<script src="http://spelprogrammering.nu/simple.js">
function start()
{
  cat = {x: 100, y: 100, speed: 10};
  hideMouse();
}

function update()
{
  clearScreen();
  
  if (keyboard.left)  { cat.x -= cat.speed; }
  if (keyboard.right) { cat.x += cat.speed; }
  if (keyboard.up)    { cat.y -= cat.speed; }
  if (keyboard.down)  { cat.y += cat.speed; }
  
  circle(cat.x, cat.y, 20, "black");
  circle(mouse.x, mouse.y, 20, "red");

  if (distance(cat, mouse) < 40) 
  {
    showMouse();
    stopUpdate(); 
  }
}

</script>
        
Gå tillbaka