topical media & game development
graphic-processing-algorithm-Appendix-p313-6-p313-6.pde / pde
size(200,400);
int step_height = 8;
int step_width = 10;
int dir = 1;
int n_steps = height/step_height;
int k=0;
float x=20,y=0;
for(int i=0; i<n_steps; i++){
x += step_width*dir;
y = -i*step_height;
rect(x+20,y+height,step_width,3);
if(x>100){
rect(x+20,y+height,40,3);
dir*=(-1);
}
if(x<20){
rect(x-10,y+height,40,3);
dir*=(-1);
}
}
(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.