public void draw() 
{
  background(102);
  
  // Update the position of the shape
  xpos = xpos + ( xspeed * xdirection );
  ypos = ypos + ( yspeed * ydirection );
  
  // Test to see if the shape exceeds the boundaries of the screen
  // If it does, reverse its direction by multiplying by -1
  if (xpos > width-r || xpos < 0) {
    xdirection *= -1;
    link.output("boing"); // ** added for MaxLink
  }
  if (ypos > height-r || ypos < 0) {
    ydirection *= -1;
    link.output("bing"); // ** added for MaxLink
  }

  // Draw the shape
  fill(40,40,140);
  ellipse(xpos, ypos, r, r);
}