> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://studio.sketchpad.cc/sp/pad/view/ro.v7-G6czcIuU/rev.2
 * 
 * authors: 
 *   (Unnamed author)

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



// This sketch builds on a prior work, "Untitled Sketch", created by [unnamed author]
// http://sketchpad.cc/sp/pad/view/ro.0dKhEdqY$BJ/rev.1756



Zoog[] zoogies = new Zoog[200];

void setup() {
  size(400,400);
  smooth();
  for (int i = 0; i < zoogies.length; i ++ ) {
    zoogies[i] = new Zoog(random(width),random(height),30,30,8);
  }
}

void draw() {
  background(255); // Draw a black background
  for (int i = 0; i < zoogies.length; i ++ ) {
    zoogies[i].display();
    zoogies[i].jiggle();
  }
}

class Zoog {
  // Zoog's variables
  float x,y,w,h,eyeSize;

  // Zoog constructor
  Zoog(float tempX, float tempY, float tempW, float tempH, float tempEyeSize) {
    x = tempX;
    y = tempY;
    w = tempW;
    h = tempH;
    eyeSize = tempEyeSize;
  }
  
  // Move Zoog
  void jiggle() { // For simplicity we have also removed the “speed� argument from the jiggle() function. Try adding it back in as an exercise.
    // Change the location
    x = x + random(-1,1);
    y = y + random(-1,1);
    // Constrain Zoog to window
    x = constrain(x,0,width);
    y = constrain(y,0,height);
  }
  
  // Display Zoog
  void display() {
    // Set ellipses and rects to CENTER mode
    ellipseMode(CENTER);
    rectMode(CENTER);  
    // Draw Zoog's arms with a for loop
    for (float i = y-h/3; i < y + h/2; i += 10) {
      stroke(0);
      line(x-w/4,i,x + w/4,i);
    }
    // Draw Zoog's body
    stroke(0);
    fill(175);
    rect(x,y,w/6,h);
    // Draw Zoog's head
    stroke(0);
    fill(255);
    ellipse(x,y-h,w,h);
    // Draw Zoog's eyes
    fill(0);
    ellipse(x-w/3,y-h,eyeSize,eyeSize*2);
    ellipse(x + w/3,y-h,eyeSize,eyeSize*2);
    // Draw Zoog's legs
    stroke(0);
    line(x-w/12,y + h/2,x-w/4,y + h/2 + 10);
    line(x + w/12,y + h/2,x + w/4,y + h/2 + 10);
  }
}