> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://friendscentral.sketchpad.cc/sp/pad/view/ro.9nWKvPrHUeH/rev.248
 * 
 * authors: 
 *   Colin Angevine

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



void setup() {
    size(500, 500); 
    fill(255, 0, 0);
} 

void draw() {
    background(255);
    
}

void mouseClicked() {
    // create a new Bouncer!
    // add it to the ArrayList!
}

class MyBouncer {
    PVector location;
    PVector velocity;
    PVector gravity;
    
    MyBouncer() {
        location = new PVector(250, 100);
        velocity = new PVector(random(-10, 10), random(-10, 10));
        gravity = new PVector(0, 0.01);
    }
    void update() {
        velocity.add(gravity);
        location.add(velocity);
        if (location.x < 0) {
            location.x = 0;
            velocity.x = velocity.x * -.95;
        }
        if (location.x < width) {
            location.x = width;
            velocity.x = velocity.x * -.95;
        }
        if (location.y < height) {
            location.y = height;
            velocity.y = velocity.x * -.9;
        }
    }
    void display() {
        ellipse(location.x, location.y, 20, 20);
    }
}