class tree{ color c; float x; float y; float xspeed; float yspeed; float gravity; float radius; float direction; tree(color tempC, float tempX, float tempY, float tempRadius, float tempXspeed,float tempYspeed, float tempGravity, float tempDirection){ c=tempC; x=tempX; y=tempY; xspeed=tempXspeed; yspeed=tempYspeed; gravity=tempGravity; radius=tempRadius; direction=tempDirection; } void shape(){ fill(10,40,51); quad(x,y,x+22,y+3,x+200,y-110,x+180,y-110); noFill(); for(int i=0;i<20;i++){ stroke(c); bezier(x+i,y+i/4,x+30+i,y-30+i,x+50,y-200,i+600,y-200); } } void display(){ fill(10,40,51,y-330); noStroke(); quad(x-5,y,x+13,y+3,x+200,y-110,x+180,y-110); fill(c); ellipse(x,y,radius,radius); } void leaf(){ fill(c); stroke(c); pushMatrix(); translate(x,y); scale(random(2,5),random(3,6)); beginShape(); vertex(1.0*radius,-0.7); bezierVertex(1.0+radius,-0.7,0.4*radius,-1.0,0.0,0.0); bezierVertex(0.0,0.0,1.0*radius,0.4,1.0*radius,-0.7); endShape(); popMatrix(); } void move(){ y=y-yspeed; yspeed=yspeed+gravity; if(y>450 ||y<150 ){ yspeed=yspeed*direction*0.99; } x=x+xspeed; if(x>595 ){ xspeed=xspeed*0; yspeed=0; } else if(x<540){ x=x-0.01; xspeed=xspeed*0.99; yspeed=0.1; } } void amove(){ y=y+yspeed; yspeed=yspeed+gravity; if(y>450 ){ yspeed=yspeed*direction*0.6; } x=x+xspeed; if(x>730 ){ xspeed=xspeed*0; yspeed=0; } } }