Tuesday, 2 September 2014

Turtle lab 2

void setup(){
 size(300, 200);
 frameRate(50);
}
float x = 0;
float y = 0;
float c = 0;
void draw(){
  x = x + 2;
  background(43, 96, 222);
  noStroke();
  if(x > 400){x = 0;}
  stroke(101, 158, 199);
  strokeWeight(10);
 line(x, 0, x, height);
 line(x-50, 0, x-50, height);
 line(x-100, 0, x-100, height);
 if(c == 0){y = y + 1; draw_turtle(); if( y == 50){c = 1;}}
  if(c == 1){y = y - 1; draw_turtle();if( y == -50){c = 0;}}

}
void draw_turtle(){
  noStroke();
 fill(127, 82, 23);
 ellipse(115, 125+y, 30, 70);
 ellipse(115, 75+y, 30, 70);
 ellipse(195, 135+y, 70, 20);
 ellipse(195, 65+y, 70, 20);
 ellipse(95, 100+y, 80, 35);
 fill(128, 101, 23);
 ellipse(150, 100+y, 150, 100);
 fill(150, 111, 51);
 ellipse(150, 100+y, 140, 90);
 fill(130, 123, 96);
 ellipse(110, 115+y, 30, 30);
 ellipse(155, 80+y, 20, 20);
 ellipse(200, 100+y, 15, 15);
 fill(0);
 ellipse(65, 110+y, 10, 10);
 ellipse(65, 90+y, 10, 10);
}



No comments:

Post a Comment