PImage loser; PImage winner; float headHeight; float headWidth; float sushiX = 0; float sushiY = 0; String instructions = "Hold the spacebar to launch sushi.\nLet go to feed the head."; void setup () { size (1000, 1000); headHeight = height/5; headWidth = width/6.5; loser = loadImage("loser.jpg"); winner = loadImage("winner.jpeg"); } void draw() { background(255); textSize(25); text(instructions, 20, 320, 300); pushMatrix(); scale(1.5); translate(-width/5.5, 0); drawHead(); drawEyes(); popMatrix();//translate and scale is only for the head, eyes, which were too big after adding in the sushi drawBody(); drawArms(); drawNose(); drawEsophagus(); drawStomach(); drawMouth(); if (keyPressed) { drawSushi(); } else { pushMatrix(); translate(sushiX, sushiY); sushiY=sushiY+10; sushiX=sushiX; scale(.22); noStroke(); fill(24, 44, 4); rect(width/8, height/8, width/6, height/6);//sushi body ellipse(width/8 + width/12, height/8 + height/6, width/6, height/20); //bottom sushi ellipse fill(255); stroke(255); ellipse(width/8 + width/12, height/8 + height/180, width/6, height/20);//top sushi ellipse fill(0); ellipse(width/6 + width/24, height/8 + height/360, width/12, height/40);//sushi filling ellipse noStroke(); fill(240, 93, 7); quad(width/6 + width/24, height/8 + height/360, width/6 + width/12, height/8 + height/360, width/4, height/75, width/5, height/20);//carrot fill(142, 216, 105); quad(width/6 + width/456, height/8 + height/456, width/6 + width/24, height/8 + height/360, width/5.1, height/30, width/7, height/80);//cucumber fill(115, 188, 80); quad(width/7, height/35, width/7, height/60, width/5.1, height/30, width/7, height/85); //cucumber shading fill(214, 99, 22); triangle(width/4, height/80, width/4, height/45, width/5, height/19);//carrot shading popMatrix(); loserTown(); winnerTown(); } if (sushiX>=700||sushiY>1000){ drawSushi(); sushiX=0; } drawOuterEsophagus(); drawLowerLip(); } void drawHead() { strokeWeight(3); stroke(0); fill(255); ellipse(width/2, headHeight/2, headWidth, headHeight); } void drawEyes() { strokeWeight(3); fill(255); ellipse(width/2, headHeight/2, width/70, height/50);//person's left eye ellipse(width/2-width/15, headHeight/2, width/110, height/90);//person's right eye } void drawNose() { strokeWeight(3); fill(255); stroke(0); bezier(440, 70, 450, 80, 260, 260, 420, 210);//make these variables } void drawBody() { fill(255); stroke(0); strokeWeight(3); bezier(460, 300, 370, 530, 165, 75, 245, height);//make these variables bezier(550, 275, 610, 570, 860, 50, 755, height); strokeWeight(6); point(400, 500);//nipple! point(580, 500);//nipple! } void drawArms() { strokeWeight(3); fill(255); bezier(300, height, 350, 220, 330, 430, 400, height);//variables bezier(600, height, 650, 0, 700, 730, 700, height);//variables } void drawMouth() { fill(0); strokeWeight(2); stroke(255); ellipse(width/2.1, height/4, width/6.5, height/10); } void drawEsophagus() { stroke(240, 0, 0, 40); fill(100, 0, 10, 40); strokeWeight(3); for (float x = height/3.4; x<=height/1.4; x=x+8) { ellipse(width/2, x, 70, 10);//these aren't scalable } } void drawSushi() { pushMatrix(); translate(sushiX, sushiY); sushiY=height*.225; sushiX=sushiX+10; scale(.22); noStroke(); fill(24, 44, 4); rect(width/8, height/8, width/6, height/6);//sushi body ellipse(width/8 + width/12, height/8 + height/6, width/6, height/20); //bottom sushi ellipse fill(255); stroke(255); ellipse(width/8 + width/12, height/8 + height/180, width/6, height/20);//top sushi ellipse fill(0); ellipse(width/6 + width/24, height/8 + height/360, width/12, height/40);//sushi filling ellipse noStroke(); fill(240, 93, 7); quad(width/6 + width/24, height/8 + height/360, width/6 + width/12, height/8 + height/360, width/4, height/75, width/5, height/20);//carrot fill(142, 216, 105); quad(width/6 + width/456, height/8 + height/456, width/6 + width/24, height/8 + height/360, width/5.1, height/30, width/7, height/80);//cucumber fill(115, 188, 80); quad(width/7, height/35, width/7, height/60, width/5.1, height/30, width/7, height/85); //cucumber shading fill(214, 99, 22); triangle(width/4, height/80, width/4, height/45, width/5, height/19);//carrot shading popMatrix(); } void drawStomach() { stroke(240, 0, 0, 40); fill(100, 0, 10, 150); ellipse(500, 700, 230, 350);//fix to use variables } void drawOuterEsophagus() {//thing to block out sushi on the way down to the stomach noStroke(); fill(100, 0, 10, 100); rect(470,300,60,550); } void drawLowerLip(){ strokeWeight(1); noFill(); stroke(0); arc(width/2.1, height/4, width/6.5, height/10,240,300); } //the following is what happens if the sushi is in the wrong spot void loserTown() { if ((0469)) { image(loser, 700, 20); } } //the following is what happens if the sushi is dropped down the esophagus void winnerTown() { if ((sushiX>=437)&&(sushiX<=468)) { image(winner, 700, 20); } } //amazing bezier trick: use println to find first and last coordinates, then mouseX,mouseY middle cordinates!