Open chasestarr opened 8 years ago
void setup() {
size(1250, 1250);
background(5);
}
void draw() {
ellipse();
ellipsetwo();
ellipsethree();
ellipsefour();
ellipsefive();
ellipsesix();
ellipseseven();
ellipseeight();
ellipsenine();
ellipseten();
}
void ellipse() {
fill(255, 0, 0);
ellipse(450, 450, 100, 50);
fill(255, 255, 255);
ellipse(450, 450, 50, 50);
fill(0);
ellipse(445, 445, 15, 15);
}
void ellipsetwo() {
fill(0, 0, 255);
ellipse(550, 550, 100, 50);
fill(255, 255, 255);
ellipse(550, 550, 50, 50);
fill(0);
ellipse(545, 545, 15, 15);
}
void ellipsethree() {
fill(0, 255, 0);
ellipse(150, 650, 100, 50);
fill(255, 255, 255);
ellipse(150, 650, 50, 50);
fill(0);
ellipse(145, 645, 15, 15);
}
void ellipsefour() {
fill(234, 175, 189);
ellipse(550, 350, 100, 50);
fill(255, 255, 255);
ellipse(550, 350, 50, 50);
fill(0);
ellipse(545, 345, 15, 15);
}
void ellipsefive() {
fill(137, 150, 189);
ellipse(750, 250, 100, 50);
fill(255, 255, 255);
ellipse(750, 250, 50, 50);
fill(0);
ellipse(745, 245, 15, 15);
}
void ellipsesix() {
fill(120, 150, 75);
ellipse(150, 150, 100, 50);
fill(255, 255, 255);
ellipse(150, 150, 50, 50);
fill(0);
ellipse(145, 145, 15, 15);
}
void ellipseseven() {
fill(123, 150, 100);
ellipse(500, 100, 100, 50);
fill(255, 255, 255);
ellipse(500, 100, 50, 50);
fill(0);
ellipse(495, 95, 15, 15);
}
void ellipseeight() {
fill(150, 150, 150);
ellipse(600, 200, 100, 50);
fill(255, 255, 255);
ellipse(600, 200, 50, 50);
fill(0);
ellipse(595, 195, 15, 15);
}
void ellipsenine() {
fill(135, 164, 178);
ellipse(400, 675, 100, 50);
fill(255, 255, 255);
ellipse(400, 675, 50, 50);
fill(0);
ellipse(395, 670, 15, 15);
}
void ellipseten() {
fill(50, 100, 150);
ellipse(800, 500, 100, 50);
fill(255, 255, 255);
ellipse(800, 500, 50, 50);
fill(0);
ellipse(795, 495, 15, 15);
}
int xPos=500;
int yPos=500;
void setup(){
size(1000,1000);
background(150);
}
void draw(){
fighter(xPos +150, yPos-50);
fighter(xPos,yPos);
fighter(xPos-150,yPos-50);
fighter(xPos-350,yPos-350);
fighter(xPos+350,yPos-350);
fighter(xPos+350,yPos+350);
fighter(xPos-350,yPos+350);
fighter(xPos,yPos-250);
fighter(xPos+200,yPos+150);
fighter(xPos-200,yPos+150);
}
void fighter(int xPos,int yPos){
fill(0);
//body
ellipse(xPos,yPos,50,50);
//struts
rect(xPos+20,yPos-5,40,7);
rect(xPos-60,yPos-5,40,7);
//wings
rect(xPos-65,yPos-55,10,105);
rect(xPos+56,yPos-55,10,105);
}
int x=450;
int y=350;
void setup(){
size(900,1000);
background(0);
}
void draw(){
spaceShip(x-300,y-250);
spaceShip(x-50,y-250);
spaceShip(x+200,y-250);
spaceShip(x-300,y-20);
spaceShip(x-50,y-20);
spaceShip(x+200,y-20);
spaceShip(x-300,y+210);
spaceShip(x-50,y+210);
spaceShip(x+200,y+210);
spaceShip(x-50,y+460);
}
void spaceShip(int x,int y){
fill(0);
strokeWeight(1);
stroke(255);
ellipse(x+50,y+25,200,200);
fill(151,47,151);
ellipse(x+50,y+50,20,40);
rect(x,y,100,50);
stroke(151,47,151);
strokeWeight(6);
line(x,y+25,x-47,y+25);
line(x+100,y+25,x+147,y+25);
}
int xPos=400; int yPos=400;
void setup(){ background(0); size(800,800);
} void draw(){ bomber(xPos+300,yPos+300); bomber(xPos-150,yPos-10); bomber(xPos-300,yPos-125); bomber(xPos-150,yPos-300); bomber(xPos+150,yPos+250); bomber(xPos+280,yPos-325); bomber(xPos+200,yPos-270); bomber(xPos+20,yPos-30); bomber(xPos-300,yPos+270); bomber(xPos+245,yPos);
} void bomber(int xPos,int yPos){ fill(0,255,0); ellipse(xPos,yPos,35,100); fill(0,100,255); ellipse(xPos,yPos-20,17,17); fill(255); rect(xPos-30,yPos+42,60,10); fill(255,0,0); ellipse(xPos,yPos+71,25,50);
}
int x=150;
int y=150;
void setup(){
size(1000,1000);
}
void draw(){
background(203,192,237);
frameRate(0);
ships(x,y);
ships(x+350,y);
ships(x+700,y);
ships(x+150,y+250);
ships(x+500,y+250);
ships(x,y+500);
ships(x+350,y+500);
ships(x+700,y+500);
ships(x+150,y+750);
ships(x+500,y+750);
}
void ships(int x, int y){
fill(random(255),random(255),random(255));
noStroke();
ellipse(x,y+10,135,125);
fill(255);
ellipse(x,y+10,100,90);
fill(random(255),random(255),random(255));
ellipse(x,y+10,65,55);
fill(0);
ellipse(x,y+50,200,75);
fill(random(255),random(255),random(255));
stroke(255);
strokeWeight(1.5);
ellipse(x-25,y+50,10,10);
ellipse(x+25,y+50,10,10);
}
int x=100;
int y=100;
void setup(){
size(1000,1000);
}
void draw(){
background(0);
fill(99,103,105);
battlestar(500,500);
fill(255);
ellipse(x+40,y-20,10,10);
ellipse(530,520,50,50);
ellipse(435,495, 50,50);
ellipse(560,540,50,50);
fill(255,0,0);
ellipse(545,530,50,50);
fill(0,0,255);
ellipse(480,495,50,50);
}
void battlestar(int x, int y){
noStroke();
rect(x+50, y-150, 20,150);
rect(x-80,y-150,20,150);
ellipse(x+40,y-20,10,10);
ellipse(x, y, 200,200);
ellipse(x+40,y-20,10,10);
}
In this homework we will be practicing how to create functions and implement parameters
Create a sketch that will draw 10 spaceships of you own design onto the screen. The space ship must contain at least 3 shapes. Create parameters that will control the x and y position as well as the color.
Please paste your code as a comment on this post