> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://bard117f12.sketchpad.cc/sp/pad/view/ro.6zNrvAuobCq/rev.327
 * 
 * authors: 
 *   Cole Berry-Miller

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



/*
Cole Berry-Miller 
9/23/12
[email protected],
The name of this sketch is pretty self-explanatory. Press some keys, click the mouse, and look around. I got the idea when I was reading the "Learning Processing" book on page 53 where there was a drawing that looked exactly like this. I  wish I could add more (a "Game Over" screen and a score tracker or something), but I already spent 5 or so hours on this and it would be too much for tonight. Maybe I'll add it later so check back again sometime this week if you got the time.
*/


int backgroundshade;
int ellipsewidth;
int ellipseheight;

void setup() {
  size(500, 500);
  backgroundshade = 255;
  smooth();
}

void draw() {
    background(backgroundshade);
  line(0, 500-mouseY+250, width-mouseX, height-mouseY);
  line(width-mouseX, 0, width-mouseX, height-mouseY);
  line(500, 500-mouseY+250, width-mouseX, height-mouseY);
   if(mousePressed){
      fill(0);
      ellipse (250,250,ellipsewidth,ellipseheight);
    }else if (keyPressed){
      fill(0,0,0,60);
      ellipse (250,250,ellipsewidth,ellipseheight);
    }else{
      ellipsewidth = 1;
      ellipseheight = 1;
    }
  if (mouseX > 250) {
    background(backgroundshade);
    if(mousePressed){
      fill(0);
      ellipse (250,250,ellipsewidth,ellipseheight);
    }else if (keyPressed){
      fill(0,0,0,60);
      ellipse (250,250,ellipsewidth,ellipseheight);
    }else{
      ellipsewidth = 1;
      ellipseheight = 1;
    }
    line(0, 500-mouseY+250, width-mouseX, height-mouseY);
    line(width-mouseX, 0, width-mouseX, height-mouseY);
    line(500, 500-mouseY+250-mouseX+250, width-mouseX, height-mouseY); 
  }else if (mouseX < 250) {
    background(backgroundshade);
    if(mousePressed){
      fill(0);
      ellipse (250,250,ellipsewidth,ellipseheight);
    }else if (keyPressed){
      fill(0,0,0,60);
      ellipse (250,250,ellipsewidth,ellipseheight);
    }else{
      ellipsewidth = 1;
      ellipseheight = 1;
    }
    line(0, 500-mouseY+250+mouseX-250, width-mouseX, height-mouseY);
    line(width-mouseX, 0, width-mouseX, height-mouseY);
    line(500, 500-mouseY+250, width-mouseX, height-mouseY);
  }
  ellipsewidth = ellipsewidth + 1;
  ellipseheight = ellipseheight + 1;
}