topical media & game development

talk show tell print

graphic-processing-learning-09-example-9-12-example-9-12.pde / pde



  // Learning Processing
  // Daniel Shiffman
  // http://www.learningprocessing.com
  
  // Example 9-12: 200 Zoog objects in an array
  
  // The only difference between this example and the previous chapter (Example 8-3) 
  // is the use of an array for multiple Zoog objects.
  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();
    }
  }
  


(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.