<script src="http://spelprogrammering.nu/simple.js">
function start()
{
  ball = {sx: 0,
          sy: 0,
          v0: 100,
          alpha: pi/4};
  
  world = {g: -9.8,
           t: 0};
  
  ball.v0x = ball.v0 * cos(ball.alpha);
  ball.v0y = ball.v0 * sin(ball.alpha);
}

function update()
{
  world.t += 0.1;

  ball.sy = ball.v0y*world.t + (world.g*world.t*world.t) / 2;
  ball.sx = ball.v0x*world.t;

  clearScreen();
  circle(ball.sx, totalHeight - ball.sy, 20, "black");
}
</script>
        
Gå tillbaka