Alexis - K

By Alexis Nelson
Bee angryBee; Bee happyBee; color mad01 = color(255, 255, 0); void setup() { size(400, 400); smooth(); angryBee = new Bee(100, 180, 3, 5); happyBee = new Bee(mouseX, mouseY, 10, mad01); } void draw() { background(118, 215, 251); angryBee.move(); angryBee.display(); println(mouseX); happyBee.follow(); happyBee.display(); } class Bee { float x, y, xpos, ypos; int fC; int sL; color mad01 = color(255, 255, 0); color mad02 = color(255, 222, 0); color mad03 = color(255, 138, 0); color mad04 = color(255, 0, 0); float speed = 1; // Distance moved each frame int direction = 1; // Direction of motion (1 is down, -1 is up) //constructor Bee(float xpos, float ypos, int smileLine, int faceColor) { x = xpos; y = ypos; sL = smileLine; fC = faceColor; } void move() { if (mouseX <400) { fC = mad01; sL = 10; } if (mouseX <300) { fC = mad02; sL = 5; } if (mouseX <250) { fC = mad03; sL = 3; x = x + random(-speed, speed); y = y + random(-speed, speed); } if (mouseX < 150) { fC = mad04; sL = 1; } } void follow() { x= mouseX; y = mouseY; } void display() { fill(0); ellipse(x, y+10, 70, 70); //body triangle(x+5, y, x-5, y, x, y-60); fill(207, 242, 255); ellipse(x-30, y-10, 50, 50); //wing ellipse(x+30, y-10, 50, 50); fill(fC); //face color ellipse(x, y+10, 50, 50); //head fill(255); ellipse(x-10, y+5, 10, 10); //eye left ellipse(x+10, y+5, 10, 10); //eye right noFill(); arc(x, y+20, 20, sL, 2*PI, PI); //smile } }

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*