<script src="http://spelprogrammering.nu/simple.js">
function Zombie(startX, startY, xSpeed)
{
  this.x      = startX;
  this.y      = startY;
  this.xSpeed = xSpeed;

  this.update = function()
  {
    this.x += this.xSpeed;
    
    save();
    translate(this.x, this.y);
    rectangle(3, 30, 23, 65, "lightgreen");
    rectangle(3, 15, 23, 65, "gray");
    circle(15, 0, 20, "lightgreen");
    circle(0, 0, 3, "red");
    rectangle(-35, 20, 30, 14, "lightgreen");
    rectangle(-20, 20, 30, 14, "gray");
    restore();
  };
}

function start()
{
  mikael = new Zombie(400, 200, -1);
  pontus = new Zombie(500, 200, -2);
}

function update()
{
  clearScreen();
  mikael.update();
  pontus.update();
}
</script>
        
Gå tillbaka