I wanted to make a bunch of ships, fish, and maybe rocks at the bottom of the ocean but I was having trouble getting the fish and ship (especially the ship... shudder shudder..) to work in the for statement.
It looks good in my opinion otherwise! A good start!
As always, here is the code!
//MAIN BIT
void setup() {
size(1200, 700);
smooth();
}
void draw() {
background(200,240,255);
randomSeed(0);
noStroke();
fill(140,200,250);
rect(0,500,width,400);
for (int i = 35; i <width +40; i += 40) { //this is randomizing color and size
int gray = int (random (220, 255));
float scalar = random (.025, 1.0);
cloud(i, 110, gray, scalar);
}
for (int i = 35; i <width +40; i += 40) {
int gray = int (random (0, 255));
float scalar = random (.025, 1.0);
bird(i,500, gray, scalar);
}
ship(500,420);
}
//THE BIRD
void bird(int x, int y, int g, float s){
pushMatrix();
scale (s); //set size
stroke(g); // set the gray value
translate(x,y);
fill(g); stroke(g);
line(0,0,10,-10);
line(10,-10,20,0);
line (20,0, 30, -10);
line (30, -10, 40, 0);
popMatrix();
}
//THE CLOUD
void cloud(int x, int y, int g, float s){
pushMatrix();
scale (s); //set size
stroke(g); // set the gray value
translate(x,y);
fill(g); stroke(g);
ellipse(0,0,100, 100);
ellipse(0-40,0+10,50, 50);
ellipse(0+20,0-55,50, 50);
ellipse(0+140,0-55,50, 50);
ellipse(0+50,0+10,80,80);
ellipse(0+100,0-10,130,130);
ellipse(0+150,0-10,100,100);
ellipse(0+55,0-60,50,50);
ellipse(0+110,0-70,60,60);
popMatrix();
}
//THE (non existent) FISH
void fish(int x, int y, int g , float s){
pushMatrix();
//fill (r,0,0);
//fill (0,gr,0);
//fill (0,0,b);
translate(x, y);
//fill(r,gr,b);
ellipse (0,0,10,5);
}
//for some reason I was having trouble with getting
//the fish and the ship to randomize.
//THE SHIP
void ship(int x, int y){ // the ship is made with a bunch of for
//statements like in the class before.
pushMatrix();
translate(x,y);
fill(0);
stroke(#482103);
//bow
for (int i=0; i <100; i += 4){
line(i,0,i,100-i);
}
//middle
for (int i=-300; i <0; i += 4){
line(i,0,i,100);
}
//poop deck
for (int i=-360; i <-200; i += 5){
line(i-25,-40,i/2,50);
}
stroke(#482103);
//cap. quarters
for (int i=-350; i <-280; i += 5){
line(i,-30,i,50-i/20);
}
stroke(#B79E8B);
//middle sail
for (int i=-200; i <100; i +=10){
line(-120, -100 +i/2,-50, -150+ i);
}
//back sail
for (int i=-150; i <80; i +=10){
line(-210, -100 +i/2,-150, -150+ i);
}
//front sail
for (int i=-70; i <120; i +=10){
line(-40, -100 +i/2,20, -150+ i);
}
//triangle sail
for (int i=30; i <100; i += 10){
line(i,-30,i,-120+i);
}
//poop deck sail
for (int i=-350; i <-220; i += 10){
line(i,-70,i,-180-i/5);
}
//cannon holes
strokeWeight(2);
for (int i=-240; i <-10; i += 25){
rect(i, 40, 10, 15);
}
//cap. quart. windows
strokeWeight(2);
for (int i=-350; i <-260; i += 25){
rect(i, -20, 20, 40);
}
//masts (front, back, middle)
strokeWeight(4);
stroke(#482103);
line(-30,0,-30,-130);
line(-190,0,-190,-200);
line(-100,0,-100,-265);
stroke(#B79E8B);
//poop deck railing
for (int i=-380; i <-220; i += 10){
line(i,-50,i,-50);
}
//railing
for (int i=-170; i <100; i += 10){
line(i,-10,i,-10);
}
popMatrix();
}
Ty, this is so well done, I am constantly blown away (haha, like a ship's sail, I'm so funny) by what you're able to do with the limited shapes available in Processing! Great job!
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHaha Gah the dad jokes hurt! Thank you so much!
ReplyDeleteI hope I didn't knock you on to your poop deck(I am so sorry)!