//Jose M. Pena //Project 4 float sunX, sunY; float sunS; float joeX=100, joeY=100; float eyesX=100, eyesY=100; float x=100; float y=100; float mouthX=joeX; float mouthX1=joeX; float mouthY=joeY; float mouthY1=joeY; float mouthS=10; int showX, showY; void setup(){ size(900, 700); initialize(); smooth(); } void initialize(){ sunX = 10; sunY = 50; sunS = .5; } void draw(){ scene(); move(); bounce(); joe(); } //object moves void move(){ sunX += sunS; mouthY+=mouthS; } void bounce(){ text("CHECK", 100,100 ); if ((sunX > width-50) || (sunX < 0)) { sunS = sunS * - 1; text("BOUNCE", 100,200 ); } if ((mouthY > joeY+50) || (mouthY < joeY)) { mouthS = mouthS * - 1; } } void scene(){ // sky, sun, garass tha waves. background(100,100,200); fill(127,255,127); rectMode(CENTER); ellipseMode(CENTER); rect(0,height,width*2,height+500); //sun fill(250,250,0); ellipse(sunX,sunY,100,100); grass(); } void joe(){ //// Move joe toward mouse. mouth(); joeX= joeX + (mouseX-joeX) / 30 ; joeY= joeY + (mouseY-joeY) / 15 ; eyesX= eyesX + (mouseX-eyesX) /27; eyesY= eyesY + (mouseY-eyesY) /12; //body fill(0); rectMode(CENTER); rect(joeX,joeY,100,100); fill(255); //top left fill(255,0,0); triangle(joeX-50,joeY+50, joeX-50, joeY-10, joeX-79, joeY-70); //lower right //triangle(joeX+50,joeY+50, joeX+50, joeY+10, joeX+80, joeY+70); //top right triangle(joeX+50,joeY+50, joeX+50, joeY-10, joeX+79, joeY-70); noStroke(); //eyes fill(255); ellipse(joeX,joeY,90,90); fill(0); ellipse(eyesX,eyesY,20,20); fill(0); rect(joeX,joeY-40,100,20); } void mouth(){ mouthX= mouthX + (mouseX-mouthX) / 30 ; mouthY= mouthY+ (mouseY-mouthY) / 15 ; mouthX1= mouthX1 + (mouseX-mouthX1) / 30 ; mouthY1= mouthY1+ (mouseY-mouthY1) / 15 ; //MOUTH //top teeth fill(255); rect(mouthX1,mouthY1+50,100,15); //jaw teeth fill(255); rect(mouthX,mouthY+75,100,15); //jaw fill(0); rect(mouthX,mouthY+88,100,10); } void grass(){ // moving grass stroke(0,127,0); float grass= mouseX-pmouseX; //makes grass move float y = height; for (float x=0; x