//Colleen Shaver
//Honey bee flies around his hive with honey river below
//use the mouse to direct the bee around the hive
//lots of reference from lander example from class
float gravity=.10;
int honeyPositionX = 0;
float beeSpeedX;
float beeSpeedY;
float hiveX;
float hiveY;
float BeeX;
float BeeY;
void setup() {
frameRate(60);
size(600, 600);
smooth();
// Set initial Honey Bee position
BeeX=width/2;
BeeY=height/2;
// Set initial Honey Bee's speed
beeSpeedX=0;
beeSpeedY=0;
}
void draw() {
//please behave bee and update based off gravity and mouse input without exploding
updateBeePosition();
//It would also be good if you stayed on the screen Mister Bee
//DRAW THE BASICS
//light blue background of hive
background(135, 250, 215);
drawHive();
drawHoney(honeyPositionX);
drawBee();
honeyPositionX++;
}
void updateBeePosition() {
// Adjust Honey Bee horizontal speed based on mouse X
if (mousePressed) {
beeSpeedY+=-.20;
if (mouseX>BeeX) {
beeSpeedX+=.20;
} else if (mouseX<BeeX) {
beeSpeedX+=-.20;
}
}
// Adjust Honey Bee vertical speed based on gravity
beeSpeedY+=gravity;
// Update Honey Bee position
BeeX+=beeSpeedX;
BeeY+=beeSpeedY;
}
void drawHive() {
// create behive using loop of hexagon pattern
fill(150, 255, 0);
noStroke();
hiveX =-120;
while (hiveX < width) {
hiveX= hiveX+100;
//Y axis for loop of Bee hive
hiveY=-120;
while (hiveY < height) {
hiveY= hiveY+100;
//shadow of honeycombs
fill (25, 195, 155);
quad(hiveX+5, hiveY+30, hiveX+25, hiveY+5, hiveX+55, hiveY+ 5, hiveX+75, hiveY+ 30);
quad(hiveX+5, hiveY+30, hiveX+25, hiveY+55, hiveX+55, hiveY+55, hiveX+75, hiveY+30);
fill(10, 135, 125);
quad(hiveX+55, hiveY+80, hiveX+75, hiveY+55, hiveX+105, hiveY+ 55, hiveX+125, hiveY+ 80);
quad(hiveX+55, hiveY+80, hiveX+75, hiveY+105, hiveX+105, hiveY+105, hiveX+125, hiveY+80);
//honeycombs
fill(20, 105, 115, mouseX);
quad(hiveX+10, hiveY+30, hiveX+30, hiveY+10, hiveX+50, hiveY+ 10, hiveX+70, hiveY+ 30);
quad(hiveX+10, hiveY+30, hiveX+30, hiveY+50, hiveX+50, hiveY+50, hiveX+70, hiveY+30);
fill (5, 45, 60, mouseY);
quad(hiveX+60, hiveY+80, hiveX+80, hiveY+60, hiveX+100, hiveY+ 60, hiveX+120, hiveY+ 80);
quad(hiveX+60, hiveY+80, hiveX+80, hiveY+100, hiveX+100, hiveY+100, hiveX+120, hiveY+80);
}
}
}
void drawBee() {
//wings
ellipseMode(CENTER);
fill(200, 255, 255, 200);
ellipse(BeeX+random(110, 115), BeeY+random(60, 65), 50, 60);
ellipse(BeeX+random(100, 105), BeeY+random(50, 55), 30, 100);
ellipse(BeeX+random(120, 125), BeeY+random(70, 75), 70, 30);
//antennaes
stroke(0);
strokeWeight(3);
line(BeeX+50, BeeY+50, BeeX+60, BeeY+60);
line(BeeX+60, BeeY+40, BeeX+70, BeeY+60);
line(BeeX+50, BeeY+50, BeeX+45, BeeY+55);
line(BeeX+60, BeeY+40, BeeX+55, BeeY+45);
//legs
line(BeeX+70, BeeY+120, BeeX+65, BeeY+140);
line(BeeX+80, BeeY+120, BeeX+75, BeeY+140);
//body of bee
noStroke();
fill(255, 255, 0);
triangle(BeeX+100, BeeY+70, BeeX+180, BeeY+80, BeeX+100, BeeY+130);
fill(255, 255, 0);
ellipse(BeeX+100, BeeY+100, 80, 60);
ellipse(BeeX+70, BeeY+80, 45, 45);
//bee's eye
fill(0);
ellipse(BeeX+60, BeeY+70, 10, 15);
//bee's stripes
stroke(0);
strokeWeight(10);
line(BeeX+85, BeeY+70, BeeX+70, BeeY+120);
line(BeeX+100, BeeY+70, BeeX+100, BeeY+130);
line(BeeX+120, BeeY+75, BeeX+130, BeeY+120);
triangle(BeeX+145, BeeY+80, BeeX+150, BeeY+95, BeeX+170, BeeY+80);
//constraint set up
if (BeeX < 0) {
BeeX = 0;
}
if (BeeY < 0) {
BeeY = 0;
}
if (BeeX > width-200) {
BeeX = width-200;
}
if (BeeY > height-150) {
BeeY = height-150;
}
}
void drawHoney(int x) {
noStroke();
rectMode(CORNER);
for (int j = 0; j <= height; j= j+5) {
fill(40, 110, 154, -10+j);
rect(0, 150+j, width, 5);
}
stroke(225, 255, 0, 10);
float a = 0.0;
float inc = TWO_PI/25.0;
for (int i = 0; i <= width; i++) {
line(i, height, i, (height - 150+15 * (sin((a-x/2)/10))));
a = a + inc;
}
stroke(230, 230, 0, 25);
for (int i = 0; i <= width; i++) {
line(i, height, i, (height - 120+15 * (sin((a-x/3)/10))));
a = a + inc;
stroke(255, 230, 0, 50);
for ( i=0; i <= width; i++) {
line(i, height, i, (height - 100+15 * (sin((a-x/4)/10))));
a = a + inc;
// made with influence of http://www-acad.sheridanc.on.ca/PROG14998/2015/interactive-toy/interactive_toy_07/index.html#
}
}
}