function start()
{
  fail =  0;

  boll1X = random(totalWidth);
  boll1Y = random(totalHeight);
  boll2X = random(totalWidth);
  boll2Y = random(totalHeight);
  boll3X = random(totalWidth);
  boll3Y = random(totalHeight);

  boll1Caught = false;
  boll2Caught = false;
  boll3Caught = false;


  alert("Welcome to the game! Catch the balls quickly!1!");
}

function update()
{
  fail = fail + 1;

  if(boll1Caught && boll2Caught && boll3Caught)
  {
    if(fail < 10)
      alert("HaxXor!");
    else if(fail < 30)
      alert("You are bloody awesome!!");
    else if(fail < 50)
      alert("You won the game! Great!");
    else if(fail < 100)
      alert("Not too shabby!");
    else if(fail < 500)
      alert("Better than a blind dog...");
    else
      alert("... What have you been smoking?");

    stopUpdate();
  }
  else
  {
    clearScreenWithColor(white);
    picture(mouseX - 5, mouseY -50, "apa.jpg"); 
    text("Fail: " + fail, 400, 50, black, 50);

    if(distance(mouseX, mouseY, boll1X, boll1Y) < 10)
      boll1Caught = true;
    if(distance(mouseX, mouseY, boll2X, boll2Y) < 10)
      boll2Caught = true;
    if(distance(mouseX, mouseY, boll3X, boll3Y) < 10)
      boll3Caught = true;

    if(! boll1Caught)
      circle(boll1X, boll1Y, 10, red);
    if(! boll2Caught)
      circle(boll2X, boll2Y, 10, red);
    if(! boll3Caught)
      circle(boll3X, boll3Y, 10, red);
  }
}