//Vogel Kak Sim
//Release your unending stream of excrement on the passerby! A and D to move, SPACE to defecate!
//Peyton Blake
//The First of October of the Year Two Thousand and Eighteen
//variables
int birdX = 200;
int birdSpeed = 5;
float kakperson1X = 0;
float kakY = 100;
int kakTime = 0;
int kakPerson1White = 0;
int kakX = birdX;
int score = 0;
int kakPersonSpeed = 1;
//clouds variables
//First cloud
float cloudHeight1 = random(5, 10);
float cloudWidth1 = random(15, 30);
float cloud1X = 0;
float cloud1Y = random(1, 300);
//Second cloud
float cloudHeight2 = random(10, 30);
float cloudWidth2 = random(60, 100);
float cloud2X = 0;
float cloud2Y = random(1, 150);
//Third Cloud
float cloudHeight3 = random(10, 55);
float cloudWidth3 = random(50, 90);
float cloud3X = 0;
float cloud3Y = random(1, 300);
//cloud Transparencies
float cloudTransparency = random(50, 100);
//Maximum distance of clouds
float maxCloudX = 500;
//canvas setup
void setup() {
size(400, 400);
//message on start
println("Kak on them all! 'A' and 'D' to move. 'SPACEBAR' to release your fury!");
}
void draw() {
background(203, 152, mouseY);
///functions
drawBuildingsSkyAndBackground();
drawBirdKak();
drawKakPerson();
}
///end of functions
void drawBuildingsSkyAndBackground() {
//background building loop 1
for (int i = -20; i<=400; i+=60) {
fill(55);
rect(i + 20, 170, 50, 400);
}
//background buildings loop 2
for (int i = -20; i<=400; i+=60) {
fill(75);
rect(i + 5, 200, 50, 400);
}
//clouds
//cloud randomizers
if (cloud1X<maxCloudX) {
cloud1X+=random(.05, .5);
//cloud speed
} else if (cloud1X>=maxCloudX) {
cloud1X=-50;
cloud1Y=random(1, 300);
cloudWidth1=random(15, 45);
fill(255, cloudTransparency);
}
//cloud randomizers
if (cloud2X<maxCloudX)
//cloud speed
cloud2X+=random(.05, .5);
else if (cloud2X>=maxCloudX) {
cloud2X = -100;
cloud2Y = random(1, 150);
cloudWidth2=random(60, 120);
}
//cloud randomizers
if (cloud3X<maxCloudX) {
cloud3X+=random(.05, .5);
//cloud speed
} else if (cloud3X>=maxCloudX) {
cloud3X=-50;
cloud3Y=random(1, 300);
cloudWidth3=random(15, 45);
fill(255, cloudTransparency);
}
//Respawn clouds after passing
if (cloud1X>=-50) {
fill(255, cloudTransparency);
ellipse(cloud1X, cloud1Y, cloudWidth1, cloudHeight1);
}
if (cloud2X>=-100) {
ellipse(cloud2X, cloud2Y, cloudWidth2, cloudHeight2);
}
if (cloud3X>=-50) {
fill(255, cloudTransparency);
ellipse(cloud3X, cloud3Y, cloudWidth3, cloudHeight3);
}
//front buildings
fill(105);
rect(0, 270, 122, 400);
rect(127, 252, 98, 400);
rect(230, 260, 82, 400);
rect(317, 280, 100, 400);
//front front buildings
fill(135);
rect(0, 350, 400, 400);
}
void drawBirdKak() {
//draw score
fill(0);
textSize(40);
text (score, 10, 40);
//kak
fill(255);
triangle(birdX, kakY-50, birdX+6, kakY, birdX-6, kakY);
//feathers
fill(180);
triangle(birdX, 20, birdX+40, 140, birdX+20, 150);
fill(190);
triangle(birdX, 20, birdX+60, 140, birdX+40, 140);
//Branch
noStroke();
fill(85, 41, 0);
quad(50, 100, 400, 100, 400, 130, 75, 110);
quad(200, 100, 150, 100, 60, 150, 60, 150);
quad(250, 100, 200, 100, 120, 150, 120, 150);
//Bird
fill(200);
ellipse(birdX, 60, 80, 80);
fill(0);
stroke(0);
//eyes
strokeWeight(1);
fill(255);
ellipse(birdX+10, 45, 15, 15);
ellipse(birdX-30, 40, 15, 15);
noStroke();
//beak and pupils
fill(100);
triangle(birdX-75, 65, birdX-15, 65, birdX-10, 45);
fill(0);
triangle(birdX-80, 60, birdX-10, 60, birdX-3, 40);
ellipse(birdX+12, 45, 5, 5);
ellipse(birdX-32, 38, 5, 5);
noStroke();
}
void drawKakPerson() {
//draw kak person1
fill(kakPerson1White);
rect(kakperson1X, 300, 50, 100);
ellipse(kakperson1X+25, 280, 70, 70);
fill(255);
//eyes
ellipse(kakperson1X+9, 270, 15, 15);
ellipse(kakperson1X+54, 269, 15, 15);
//pupils
stroke(0);
fill(0);
ellipse(kakperson1X+7, 268, 5, 5);
ellipse(kakperson1X+58, 268, 5, 5);
//mouth
fill(220);
arc(kakperson1X+30, 295, 50, 50, PI, PI*2);
fill(200, 50, 0);
arc(kakperson1X+18, 295, 20, 20, PI, PI*2);
//move across with modulo and come back, increase in speed relative to score
kakperson1X = ((float)millis() * ((1+score)*.1))%500-100;
//legs
stroke(0);
strokeWeight(1);
line(birdX-20, 85, birdX-30, 100);
line(birdX+12, 85, birdX+23, 100);
noStroke();
//change color if hit
if (kakperson1X < -50) {
kakPerson1White = 0;
}
//define kak drop and speed
if (kakTime != 0) {
kakY = 100 + ((millis()-kakTime) * .5);
}
//returns as black, kak disappers
if (kakY >= 300 && kakperson1X <= kakX && kakperson1X + 50 >= kakX) {
kakPerson1White = 255;
kakTime = 0;
kakY = 100;
score = score+1;
}
//moves kak back to bird, resets score if missed
if (kakY >= 400 ) {
kakY = 100;
kakTime = 0;
score = 0;
}
}
//Bird moves along branch with a and d keys, restrains bird to branch boundaries
void keyPressed() {
if (key == 'a' && birdX >= 75) {
birdX = birdX-birdSpeed;
}
if (key == 'd' && birdX <= 355) {
birdX = birdX+birdSpeed;
}
if (key == ' ') {
kakTime = millis();
kakX = birdX;
}
}
// :)