topical media & game development

talk show tell print

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



  // Learning Processing
  // Daniel Shiffman
  // http://www.learningprocessing.com
  
  // Example 9-10: Interactive stripes
  
  // An array of stripes
  Stripe[] stripes = new Stripe[10];
  
  void setup() {
    size(200,200);
    
    // Initialize all Stripe objects
    for (int i = 0; i < stripes.length; i ++ ) {
      stripes[i] = new Stripe();
    }
  }
  
  void draw() {
    
    background(100);
    // Move and display all Stripe objects
    for (int i = 0; i < stripes.length; i ++ ) {
      // Check if mouse is over the Stripe
      stripes[i].rollover(mouseX,mouseY); // Passing the mouse coordinates into an object.
      stripes[i].move();
      stripes[i].display();
    }
  }
  


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