topical media & game development

talk show tell print

graphic-processing-algorithm-Ch03-p80-p80.pde / pde



  MyShape[] shape = new MyShape[12*12];
  void setup(){
    size(350,350); //make the screen big enough to see
    for(int y=0; y<12; y++){ //for 12 steps in y
      for(int x=0; x<12; x++){ //for 12 steps in x
        //make a shape (calling the polygon constructor)
        shape[y*12+x] = new MyShape(5, 10.,x*20., y*20.);
        shape[y*12+x].move(10.*x, 10.*y);
      }
    }
  }
  void draw(){
    for(int y=0; y<12; y++){ //for 12 steps in y
      for(int x=0; x<12; x++){ //for 12 steps in x
        shape[y*12+x].plot(); // plot the shapes
      }
    }
  }
  


(C) Æliens 04/09/2009

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.