topical media & game development

talk show tell print

graphic-processing-learning-03-example-3-3-example-3-3.pde / pde



  // Learning Processing
  // Daniel Shiffman
  // http://www.learningprocessing.com
  
  // Example 3-3: Zoog as dynamic sketch with variation
  void setup() {
    size(200,200);  // Set the size of the window
    smooth();
  }
  
  void draw() {
    background(255);  // Draw a white background 
    
    // Set ellipses and rects to CENTER mode
    ellipseMode(CENTER);
    rectMode(CENTER); 
    
    // Draw Zoog's body
    stroke(0);
    fill(175);
    // ZoogÕs body is drawn at the location (mouseX, mouseY).
    rect(mouseX,mouseY,20,100);
  
    // Draw Zoog's head
    stroke(0);
    fill(255);
    // ZoogÕs head is drawn above the body at the location (mouseX, mouseY - 30).
    ellipse(mouseX,mouseY-30,60,60); 
  
    // Draw Zoog's eyes
    fill(0); 
    ellipse(81,70,16,32); 
    ellipse(119,70,16,32);
  
    // Draw Zoog's legs
    stroke(0);
    line(90,150,80,160);
    line(110,150,120,160);
  }
  
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.