Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
/*

 SUBWAY SANDWITCHES MAKER
 An interactive toy by Yujin Seol
 
 The user can move ingredients that you want from the container to the bread.
 The user can remove the ingredients on the bread by using the bread button on the right side. 
 The user can change kinds of the bread with the bread button.
 
 */



//define colors of ingredients on the bread
float r = 255;
float g = 217;
float b = 142;
float a=50;
color cucumberOnBread1 = color(r, g, b);
color tomatoOnBread1 = color(r, g, b);
color oliveOnBread1 = color(r, g, b);
color onionOnBread1 = color(r, g, b);
color pickleOnBread1 = color(r, g, b);
color lettuceOnBread1 = color(r, g, b);

color cucumberOnBread2 = color(r, g, b);
color tomatoOnBread2 = color(r, g, b);
color oliveOnBread2 = color(r, g, b);
color onionOnBread2 = color(r, g, b);
color pickleOnBread2 = color(r, g, b);
color lettuceOnBread2 = color(r, g, b);

color cucumberOnBreadShadow = color(r, g, b, a);
color tomatoOnBreadShadow = color(r, g, b, a);
color oliveOnBreadShadow = color(r, g, b, a);
color onionOnBreadShadow = color(r, g, b, a);
color pickleOnBreadShadow = color(r, g, b, a);
color lettuceOnBreadShadow = color(r, g, b, a);

//define a color of the reset button
float resetR=29;
float resetG=68;
float resetB=16;
color resetButtonPressed = color(resetR, resetG, resetB);

//make the time slower when pick the ingredients
int count = 0;
boolean wait = false;

//switch for all ingredients
boolean cucu = false;
boolean toma = false;
boolean oliv = false;
boolean onio = false;
boolean pick = false;
boolean lett = false;

//reset button
boolean reset = false;

//cucmber button position
float buttoncuX = 40;
float buttoncuY = 250;
//tomato button position
float buttontoX = 160;
float buttontoY = 250;
//olive button position
float buttonolX = 280;
float buttonolY = 250;
//onion button position
float buttononX = 40;
float buttononY = 320;
//pickle button position
float buttonpiX = 160;
float buttonpiY = 320;
//lettuce button position
float buttonleX = 280;
float buttonleY = 320;

//bread button position
float buttonbrX = 134;
float buttonbrY = 108;

//reset buttion position
float buttonreX = 310;
float buttonreY = 143;

//button width/height
float buttonW = 60;
float buttonH = 30;

int breadType=0;


void setup() {
  size(400, 400);  
  frameRate(60);
  smooth();
}


void draw() {
  background(29, 68, 16);
  noStroke();

  //draws environment
  drawBackground();
  drawContainer();
  drawIngredients();
  drawSignboard();
  drawBread();
  drawIngredientsOnBread();
  drawResetButton();
  drawSauce();

  //delay function
  if (wait) {
    count ++;
  }
  if (count ==10) {
    wait = false;
    count = 0;
  }

  //cucumber button
  buttonW = 80;
  buttonH = 40;
  if (mouseX >= buttoncuX && mouseY >= buttoncuY && mouseX <= buttoncuX+buttonW && mouseY <= buttoncuY+buttonH && mousePressed && cucu && !wait) {
    cucu = false;

    wait = true;
  } else if (mouseX >= buttoncuX && mouseY >= buttoncuY && mouseX <= buttoncuX+buttonW && mouseY <= buttoncuY+buttonH && mousePressed && !wait) {
    //turns off all other ingredients
    cucu = true;
    toma = false;
    oliv = false;
    onio = false;
    pick = false;
    lett = false;
    reset=false;

    wait = true;
  }

  //tomato button
  buttonW = 80;
  buttonH = 40;
  if (mouseX >= buttontoX && mouseY >= buttontoY && mouseX <= buttontoX+buttonW && mouseY <= buttontoY+buttonH && mousePressed && toma && !wait) {
    toma = false;

    wait = true;
  } else if (mouseX >= buttontoX && mouseY >= buttontoY && mouseX <= buttontoX+buttonW && mouseY <= buttontoY+buttonH && mousePressed && !wait) {
    //turns off all other ingredients
    cucu = false;
    toma = true;
    oliv = false;
    onio = false;
    pick = false;
    lett = false;
    reset=false;

    wait = true;
  }

  //olive button
  buttonW = 80;
  buttonH = 40;
  if (mouseX >= buttonolX && mouseY >= buttonolY && mouseX <= buttonolX+buttonW && mouseY <= buttonolY+buttonH && mousePressed && oliv && !wait) {
    oliv = false;

    wait = true;
  } else if (mouseX >= buttonolX && mouseY >= buttonolY && mouseX <= buttonolX+buttonW && mouseY <= buttonolY+buttonH && mousePressed && !wait) {
    //turns off all other ingredients
    cucu = false;
    toma = false;
    oliv = true;
    onio = false;
    pick = false;
    lett = false;
    reset=false;

    wait = true;
  }


  //onion button
  buttonW = 80;
  buttonH = 40;
  if (mouseX >= buttononX && mouseY >= buttononY && mouseX <= buttononX+buttonW && mouseY <= buttononY+buttonH && mousePressed && onio && !wait) {
    onio = false;

    wait = true;
  } else if (mouseX >= buttononX && mouseY >= buttononY && mouseX <= buttononX+buttonW && mouseY <= buttononY+buttonH && mousePressed && !wait) {
    //turns off all other ingredients
    cucu = false;
    toma = false;
    oliv = false;
    onio = true;
    pick = false;
    lett = false;
    reset=false;

    wait = true;
  }

  //pickle button
  buttonW = 80;
  buttonH = 40;
  if (mouseX >= buttonpiX && mouseY >= buttonpiY && mouseX <= buttonpiX+buttonW && mouseY <= buttonpiY+buttonH && mousePressed && pick && !wait) {
    pick = false;

    wait = true;
  } else if (mouseX >= buttonpiX && mouseY >= buttonpiY && mouseX <= buttonpiX+buttonW && mouseY <= buttonpiY+buttonH && mousePressed && !wait) {
    //turns off all other ingredients
    cucu = false;
    toma = false;
    oliv = false;
    onio = false;
    pick = true;
    lett = false;
    reset=false;

    wait = true;
  }

  //lettuce button
  buttonW = 70;
  buttonH = 40;
  if (mouseX >= buttonleX && mouseY >= buttonleY && mouseX <= buttonleX+buttonW && mouseY <= buttonleY+buttonH && mousePressed && lett && !wait) {
    lett = false;

    wait = true;
  } else if (mouseX >= buttonleX && mouseY >= buttonleY && mouseX <= buttonleX+buttonW && mouseY <= buttonleY+buttonH && mousePressed && !wait) {
    //turns off all other ingredients
    cucu = false;
    toma = false;
    oliv = false;
    onio = false;
    pick = false;
    lett = true;
    reset=false;

    wait = true;
  }

  //reset button
  buttonW = 50;
  buttonH = 40;
  if (mouseX >= buttonreX && mouseY >= buttonreY && mouseX <= buttonreX+buttonW && mouseY <= buttonreY+buttonH && mousePressed && reset && !wait) {
    reset = false;

    wait = true;
  } else if (mouseX >= buttonreX && mouseY >= buttonreY && mouseX <= buttonreX+buttonW && mouseY <= buttonreY+buttonH && mousePressed && !wait) {
    //turns off all other ingredients
    cucu = false;
    toma = false;
    oliv = false;
    onio = false;
    pick = false;
    lett = false;
    reset=true;

    wait = true;
  }

  //
  if (cucu) {
    drawCucumber();
  } else if (toma) {
    drawTomato();
  } else if (oliv) {
    drawOlive();
  } else if (onio) {
    drawOnion();
  } else if (pick) {
    drawPickle();
  } else if (lett) {
    drawLettuce();
  } else {
  }


  //bread button range
  buttonW = 140;
  buttonH = 80;

  if (mouseX >= buttonbrX && mouseY >= buttonbrY && mouseX <= buttonbrX+buttonW && mouseY <= buttonbrY+buttonH && mousePressed && cucu) {
    cucu = false;
    r = 201;
    g = 255;
    b = 57;
    cucumberOnBread1 = color(r, g, b);

    r = 152;
    g = 196;
    b = 34;
    cucumberOnBread2 = color(r, g, b);

    r=0;
    g=0;
    b=0;
    a=50;
    cucumberOnBreadShadow = color(r, g, b, a);
  } else if (mouseX >= buttonbrX && mouseY >= buttonbrY && mouseX <= buttonbrX+buttonW && mouseY <= buttonbrY+buttonH && mousePressed && toma) {
    toma = false;
    r = 255;
    g = 80;
    b = 57;
    tomatoOnBread1 = color(r, g, b);

    r = 194;
    g = 57;
    b = 40;
    tomatoOnBread2 = color(r, g, b);

    r=0;
    g=0;
    b=0;
    a=50;
    tomatoOnBreadShadow = color(r, g, b, a);
  } else if (mouseX >= buttonbrX && mouseY >= buttonbrY && mouseX <= buttonbrX+buttonW && mouseY <= buttonbrY+buttonH && mousePressed && oliv) {
    oliv = false;
    r =4;
    g = 16;
    b = 1;
    oliveOnBread1 = color(r, g, b);

    r = 16;
    g = 35;
    b = 11;
    oliveOnBread2 = color(r, g, b);

    r=0;
    g=0;
    b=0;
    a=50;
    oliveOnBreadShadow = color(r, g, b, a);
  } else if (mouseX >= buttonbrX && mouseY >= buttonbrY && mouseX <= buttonbrX+buttonW && mouseY <= buttonbrY+buttonH && mousePressed && onio) {
    onio = false;
    r =156;
    g =117;
    b = 187;
    onionOnBread1 = color(r, g, b);

    r = 119;
    g = 84;
    b = 148;
    onionOnBread2 = color(r, g, b);

    r=0;
    g=0;
    b=0;
    a=50;
    onionOnBreadShadow = color(r, g, b, a);
  } else if (mouseX >= buttonbrX && mouseY >= buttonbrY && mouseX <= buttonbrX+buttonW && mouseY <= buttonbrY+buttonH && mousePressed && pick) {
    pick = false;
    r =75;
    g =96;
    b = 20;
    pickleOnBread1 = color(r, g, b);

    r = 64;
    g = 81;
    b = 18;
    pickleOnBread2 = color(r, g, b);

    r=0;
    g=0;
    b=0;
    a=50;
    pickleOnBreadShadow = color(r, g, b, a);
  } else if (mouseX >= buttonbrX && mouseY >= buttonbrY && mouseX <= buttonbrX+buttonW && mouseY <= buttonbrY+buttonH && mousePressed && lett) {
    lett = false;
    r =136;
    g =162;
    b = 72;
    lettuceOnBread1 = color(r, g, b);

    r = 108;
    g = 134;
    b = 45;
    lettuceOnBread2 = color(r, g, b);

    r=0;
    g=0;
    b=0;
    a=50;
    lettuceOnBreadShadow = color(r, g, b, a);
  }
}


//when the mouse clicked, kinds of a bread are randomly changed and all ingredients on the bread are disappeared
void mouseClicked() {
  if (mouseX >= buttonreX && mouseY >= buttonreY && mouseX <= buttonreX+buttonW && mouseY <= buttonreY+buttonH && reset) {
    breadType=int(random(0, 5));

    r = 255;
    g = 217;
    b = 142;
    a=50;
    cucumberOnBread1 = color(r, g, b);
    tomatoOnBread1 = color(r, g, b);
    oliveOnBread1 = color(r, g, b);
    onionOnBread1 = color(r, g, b);
    pickleOnBread1 = color(r, g, b);
    lettuceOnBread1 = color(r, g, b);

    cucumberOnBread2 = color(r, g, b);
    tomatoOnBread2 = color(r, g, b);
    oliveOnBread2 = color(r, g, b);
    onionOnBread2 = color(r, g, b);
    pickleOnBread2 = color(r, g, b);
    lettuceOnBread2 = color(r, g, b);

    cucumberOnBreadShadow = color(r, g, b, a);
    tomatoOnBreadShadow = color(r, g, b, a);
    oliveOnBreadShadow = color(r, g, b, a);
    onionOnBreadShadow = color(r, g, b, a);
    pickleOnBreadShadow = color(r, g, b, a);
    lettuceOnBreadShadow = color(r, g, b, a);
  }
}


//when the mouse is pressed, the reset button changes its colour
void mousePressed() {
  if (mouseX >= buttonreX && mouseY >= buttonreY && mouseX <= buttonreX+buttonW && mouseY <= buttonreY+buttonH && reset) {

    r=46;
    g=105;
    b=27;
    resetButtonPressed=color(r, g, b);
  }
}


//when the mouse is released, the reset button's colour is changed to the default colour
void mouseReleased() {
  r=29;
  g=68;
  b=16;
  resetButtonPressed=color(r, g, b);
}


//draw holdable cucumber
void drawCucumber() {
  float x = mouseX;
  float y = mouseY;

  fill(0, 0, 0, 50);
  ellipse(x, y, 37, 32);
  fill(190, 246, 41); 
  ellipse(x, y, 30, 25);
}


//draw holdable tomato
void drawTomato() {
  float x = mouseX;
  float y = mouseY;

  fill(0, 0, 0, 50);
  ellipse(x, y, 37, 32);
  fill(255, 80, 57);
  ellipse(x, y, 30, 25);
}


//draw holdable olive
void drawOlive() {
  float x = mouseX;
  float y = mouseY;

  fill(0, 0, 0, 50);
  ellipse(x, y, 32, 29);
  fill(16, 35, 11);
  ellipse(x, y, 25, 22);
}


//draw holdable onion
void drawOnion() {
  float x = mouseX;
  float y = mouseY;

  fill(0, 0, 0, 50);
  arc(x, y, 40, 40, 1, PI+QUARTER_PI);
  fill(189, 156, 215);
  arc(x, y, 33, 33, 1, PI+QUARTER_PI);
}


//draw holdable pickle
void drawPickle() {
  float x = mouseX;
  float y = mouseY;

  fill(0, 0, 0, 50);
  ellipse(x, y, 32, 29);
  fill(75, 96, 20);
  ellipse(x, y, 25, 22);
}


//draw holdable lettuce
void drawLettuce() {
  float x = mouseX;
  float y = mouseY;

  fill(0, 0, 0, 50);
  triangle(x, y-7, x+25, y+22, x-17, y+27);
  fill(167, 194, 101);
  triangle(x, y, x+17, y+17, x-10, y+22);
}


//draw background stripes
void drawBackground() {
  float r=29;
  float g=68;
  float b=16;
  float section = 0;

  for (int i = 0; i < 5; i += 1) {
    fill(r, g, b);

    rectMode(CORNERS);
    rect(0, section, width, height);

    r -= 10;
    g -= 10;
    b -= 10;
    section += 27;
  }
}


//draw container
void drawContainer() {
  int r = 70;
  int g = 70;
  int b = 70;

  //Yellow Shelve
  fill(160, 135, 17);
  rect(0, 131, width, height);

  fill(181, 156, 40);
  rect(0, 201, width, 212);

  //Green Shelves
  fill(8, 23, 4);
  rect(0, 212, width, height);

  rectMode(CORNERS);
  fill(29, 68, 16);
  rect(26, 226, 134, 300, 20, 5, 5, 5);
  rect(26, 310, 134, 382, 5, 5, 5, 20);
  rect(144, 226, 253, 300, 5);
  rect(144, 310, 253, 382, 5);
  rect(262, 226, 371, 300, 5, 20, 5, 5);
  rect(262, 310, 371, 382, 5, 5, 20, 5);

  fill(8, 23, 4, 50);
  rect(36, 236, 361, 372, 25);
}


//draw signboard
void drawSignboard() {
  float x=124;
  float y=36;
  float a=random(0, 130);  

  //signboard shadow
  fill(8, 23, 4, 120);
  rect(64, 35, 335, 96, 15);

  //bar
  stroke(8, 23, 4);
  strokeWeight(13);
  line(130, 0, 130, 40);
  line(270, 0, 270, 40);
  noStroke();

  //signboard
  fill(160, 135, 17);
  rect(71, 19, 328, 86, 3);
  stroke(29, 68, 16);
  strokeWeight(5);
  fill(0, 0, 0, 0);
  rect(76, 24, 323, 81, 3);
  noStroke();

  //S
  stroke(255, 255, 255);
  strokeWeight(7);
  line(x, y, x+18, y);
  line(x, y, x, y+16);
  line(x, y+16, x+18, 52);
  line(x+18, y+16, x+18, y+32);
  line(x+18, y+32, x-18, y+32);
  line(x-18, y+32, x-13, y+27);

  //U
  line(x+27, y, x+27, y+32);
  line(x+27, y+32, x+45, y+32);
  line(x+45, y+32, x+45, y);

  //B
  fill(0, 0, 0, 0);
  rect(x+54, y, x+72, y+32, 2);
  line(x+54, y+16, x+72, y+16);

  //W
  stroke(245, 218, 2);
  line(x+81, y, x+81, y+32);
  line(x+81, y+32, x+99, y+32);
  line(x+99, y+32, x+99, y);
  line(x+90, y, x+90, y+32);

  //A
  line(x+108, y+16, x+108, y+32);
  line(x+126, y+16, x+126, y+32);
  line(x+108, y+16, x+126, y+16);
  line(x+117, y, x+108, y+16);
  line(x+117, y, x+126, y+16);

  //Y
  line(x+129, y, x+138, y+16);
  line(x+138, y+16, x+147, y);
  line(x+138, y+16, x+138, y+32);
  line(x+147, y, x+165, y);
  line(x+165, y, x+160, y+5);

  //Glittering effects - Square line
  stroke(69, 127, 50, a);
  strokeWeight(5);
  fill(0, 0, 0, 0);
  rect(76, 24, 323, 81, 3);
  noStroke();

  //Glittering effects - S
  stroke(250, 231, 69, a);
  strokeWeight(7);
  line(x, y, x+18, y);
  line(x, y, x, y+16);
  line(x, y+16, x+18, 52);
  line(x+18, y+16, x+18, y+32);
  line(x+18, y+32, x-18, y+32);
  line(x-18, y+32, x-13, y+27);

  //Glittering effects - U
  line(x+27, y, x+27, y+32);
  line(x+27, y+32, x+45, y+32);
  line(x+45, y+32, x+45, y);

  //Glittering effects - B
  fill(0, 0, 0, 0);
  rect(x+54, y, x+72, y+32, 2);
  line(x+54, y+16, x+72, y+16);

  //Glittering effects - W
  stroke(255, 255, 255, a);
  line(x+81, y, x+81, y+32);
  line(x+81, y+32, x+99, y+32);
  line(x+99, y+32, x+99, y);
  line(x+90, y, x+90, y+32);

  //Glittering effects - A
  line(x+108, y+16, x+108, y+32);
  line(x+126, y+16, x+126, y+32);
  line(x+108, y+16, x+126, y+16);
  line(x+117, y, x+108, y+16);
  line(x+117, y, x+126, y+16);

  //Glittering effects - Y
  line(x+129, y, x+138, y+16);
  line(x+138, y+16, x+147, y);
  line(x+138, y+16, x+138, y+32);
  line(x+147, y, x+165, y);
  line(x+165, y, x+160, y+5);
  noStroke();
}


//draw Ingredients
void drawIngredients() {
  float x=68;
  float y=256;
  float shadowX=80;
  float shadowY=270;

  //shadows
  fill(8, 23, 4, 70);
  ellipse(shadowX, shadowY, 95, 45);
  ellipse(shadowX+120, shadowY, 95, 45);
  ellipse(shadowX+237, shadowY, 95, 45);
  ellipse(shadowX, shadowY+73, 95, 45);
  ellipse(shadowX+120, shadowY+73, 95, 45);
  ellipse(shadowX+237, shadowY+73, 95, 45);

  //cucumbers
  fill(152, 196, 34);
  ellipse(x, y, 27, 18);
  ellipse(x+10, y+7, 13, 13);
  ellipse(x+30, y+11, 30, 19);
  fill(190, 246, 41);
  ellipse(x-7, y+15, 30, 22);
  ellipse(x+33, y+20, 33, 14);
  ellipse(x+22, y+7, 25, 17);
  fill(237, 255, 188);
  ellipse(x+39, y, 30, 18);
  ellipse(x+15, y+22, 22, 23);

  //tomatoes
  x=182;
  y=255;
  fill(194, 57, 40);
  ellipse(x-10, y+25, 27, 17);
  ellipse(x+22, y+19, 27, 20);
  ellipse(x+37, y, 30, 20);
  fill(255, 80, 57);
  ellipse(x+2, y+16, 21, 14);
  ellipse(x+25, y+5, 27, 14);
  ellipse(x+44, y+25, 26, 21);
  ellipse(x+10, y+10, 15, 15);
  fill(255, 148, 134);
  ellipse(x+37, y+15, 20, 13);
  ellipse(x, y, 27, 18);

  //olives
  x=294;
  y=253;
  fill(4, 16, 1);
  ellipse(x+13, y+3, 14, 15);
  ellipse(x+7, y+17, 15, 16);
  ellipse(x-4, y+23, 15, 16);
  ellipse(x+23, y+15, 25, 25);
  ellipse(x+23, y+27, 16, 15);
  ellipse(x+37, y+8, 16, 15);
  fill(16, 35, 11);
  ellipse(x, y, 15, 14);
  ellipse(x+22, y, 16, 17);
  ellipse(x+42, y+20, 20, 11);

  //onions
  x=57;
  y=340;
  fill(119, 84, 148);
  arc(x+17, y+5, 30, 30, 1, PI+QUARTER_PI);
  arc(x+29, y-10, 30, 30, 1, PI+QUARTER_PI);
  arc(x+58, y-1, 24, 24, 1, PI+QUARTER_PI);
  fill(156, 117, 187);
  arc(x+49, y-5, 30, 30, 1, PI+QUARTER_PI);
  arc(x+8, y, 30, 30, 0, PI+QUARTER_PI);
  fill(189, 156, 215);
  arc(x+32, y+5, 30, 30, 0.3, PI+QUARTER_PI);
  arc(x+52, y+8, 30, 30, 1, PI+QUARTER_PI);

  //pickles
  x=190;
  y=331;
  fill(75, 96, 20);
  ellipse(x-10, y+17, 21, 20);
  ellipse(x+15, y+3, 19, 18);
  ellipse(x+29, y+7, 19, 18);
  fill(64, 81, 18);
  ellipse(x+17, y+20, 20, 19);
  ellipse(x, y, 22, 23);
  fill(96, 116, 43);
  ellipse(x+35, y+20, 20, 19);
  ellipse(x+4, y+15, 20, 19);

  //lettuces
  fill(108, 134, 45);
  quad(333, 333, 352, 343, 343, 360, 322, 352);
  fill(167, 194, 101);
  quad(292, 319, 309, 332, 311, 339, 297, 341);
  quad(311, 336, 338, 318, 342, 349, 328, 348);
  quad(303, 330, 324, 342, 308, 346, 302, 332);
  fill(136, 162, 72);
  quad(314, 335, 320, 323, 328, 352, 313, 367);
  quad(284, 340, 304, 330, 310, 354, 292, 355);
}


//draw Bread
void drawBread() {
  float x=width/2;
  float y=145;
  rectMode(CENTER);

  if (breadType==0) {
    //shadow
    fill(68, 56, 0, 50);
    rect(x, y+27, 163, 48, 15);

    //bread
    fill(253, 234, 197);
    rect(x, y-20, 140, 40, 15);
    rect(x, y+20, 150, 45, 15, 15, 17, 17);

    //bread inner
    fill(255, 217, 142);
    rect(x, y-14, 125, 35, 15);
    rect(x, y+10, 135, 35, 15);
  } else if (breadType==1) {
    //shadow
    fill(68, 56, 0, 50);
    ellipse(x, y+32, 175, 63);

    //bread
    fill(246, 181, 54);
    ellipse(x, y-20, 160, 60);
    ellipse(x, y+20, 165, 65);

    //bread inner
    fill(255, 217, 142);
    ellipse(x, y-15, 145, 40);
    ellipse(x, y+15, 150, 45);
  } else if (breadType==2) {
    //shadow
    fill(68, 56, 0, 50);
    rect(x, y+27, 163, 48, 30);

    //bread
    fill(225, 146, 93);
    rect(x, y-20, 141, 40, 15);
    rect(x, y+20, 150, 45, 15, 15, 30, 30);
    ellipse(x, y-27, 54, 47);
    ellipse(x-45, y-27, 50, 47);
    ellipse(x+45, y-27, 50, 47);

    //bread inner
    fill(255, 217, 142);
    rect(x, y-14, 125, 35, 50, 50, 15, 15);
    rect(x, y+10, 135, 35, 15);
  } else if (breadType==3) {
    //shadow
    fill(68, 56, 0, 50);
    rect(x, y+27, 173, 48, 30);

    //bread
    fill(187, 151, 109);
    rect(x, y-20, 150, 40, 30);
    rect(x, y+20, 160, 45, 30, 30, 35, 35);

    //bread inner
    fill(255, 217, 142);
    rect(x, y-14, 125, 35, 30);
    rect(x, y+10, 135, 35, 30);
  } else if (breadType==4) {
    //shadow
    fill(68, 56, 0, 50);
    rect(x, y+27, 185, 48, 15);

    //bread
    fill(205, 139, 62);
    rect(x, y-20, 160, 40, 40);
    rect(x, y+20, 170, 45, 40, 40, 45, 45);

    //bread inner
    fill(255, 217, 142);
    ellipse(x, y-15, 145, 40);
    ellipse(x, y+13, 150, 35);
  }
}


//This is the ingredients on the bread that only appears when ingredients are added
void drawIngredientsOnBread() {

  //cucumbers on bread
  float x=153;
  float y=128;
  fill(cucumberOnBreadShadow);
  ellipse(x+9, y+10, 33, 15);
  fill(cucumberOnBread2);
  ellipse(x+9, y+10, 18, 20);
  ellipse(x+10, y-5, 17, 19);
  fill(cucumberOnBread1);
  ellipse(x, y, 20, 17);
  ellipse(x+14, y+7, 19, 15);

  //tomatoes on bread
  x=181;
  y=128;
  fill(tomatoOnBreadShadow);
  ellipse(x+22, y+10, 33, 15);
  fill(tomatoOnBread2);
  ellipse(x+20, y-6, 18, 16);
  fill(tomatoOnBread1);
  ellipse(x+12, y+1, 17, 18);
  ellipse(x+28, y+4.5, 19, 18);

  //olives on bread
  x=220;
  y=128;
  fill(oliveOnBreadShadow);
  ellipse(x+20, y+10, 33, 15);
  fill(oliveOnBread1);
  ellipse(x+12, y-4, 15, 11);
  ellipse(x+20, y, 16, 12);
  ellipse(x+30, y+5, 11, 16);
  fill(oliveOnBread2);
  ellipse(x+14, y+5, 12, 13);
  ellipse(x+27, y-7, 12, 12);

  //onions on bread
  x=153;
  y=152;
  fill(onionOnBreadShadow);
  ellipse(x+9, y+10, 33, 15);
  fill(onionOnBread2);
  arc(x+10, y+5, 22, 22, 1, PI+QUARTER_PI);
  fill(onionOnBread1);
  arc(x-3, y+2, 20, 20, 0.3, PI+QUARTER_PI);
  arc(x+22, y+6, 25, 25, 0.7, PI+QUARTER_PI);

  //pickles on bread
  x=181;
  y=152;
  fill(pickleOnBreadShadow);
  ellipse(x+22, y+10, 33, 15);
  fill(pickleOnBread2);
  ellipse(x+17, y+9, 11, 11);
  ellipse(x+31, y, 14, 11);
  fill(pickleOnBread1);
  ellipse(x+10, y+2, 12, 13);
  ellipse(x+20, y, 12, 12);
  ellipse(x+25, y+5, 15, 14);

  //lettuces on bread
  x=220;
  y=152;
  fill(lettuceOnBreadShadow);
  ellipse(x+20, y+10, 33, 15);
  fill(lettuceOnBread2);
  quad(242, 154, 257, 157, 247, 163, 235, 162);
  fill(lettuceOnBread1);
  quad(226, 153, 241, 153, 248, 170, 238, 166);
  quad(237, 152, 254, 148, 239, 162, 239, 160);
}


//draw bread reset button 
void drawResetButton() {
  float x=335;
  float y=163;
  float a=random(0, 130);  


  //button
  fill(181, 156, 40);
  rect(x+2, y+2, 50, 40, 5);
  fill(resetButtonPressed);
  rect(x, y, 50, 40, 5);

  //bread icon
  fill(0, 0, 0, 50);
  ellipse(x, y+7, 40, 10);
  fill(255, 201, 97);
  ellipse(x-10, y, 10, 10);
  ellipse(x, y, 10, 10);
  ellipse(x+10, y, 10, 10);
  stroke(255, 201, 97);
  strokeWeight(5);
  line(x-7, y+3, x+7, y+3);
  noStroke();
  fill(219, 151, 19);
  ellipse(x, y+5, 23.5, 5);
}

void drawSauce() {
  float x=80;
  float y=150;

  //sauce1
  //sauce shadow
  fill(0, 0, 0, 50);
  ellipse(x, y+28, 35, 15);

  //sauce bottle
  fill(252, 220, 92);
  rect(x, y, 25, 60, 5);
  fill(235, 200, 61);
  rect(x-5, y+2, 8, 50, 5);

  //sauce cap
  fill(255);
  rect(x, y-35.5, 25, 11, 5);
  stroke(255);
  strokeWeight(7);
  line(x, y-43, x, y-35);
  noStroke();

  //sauce2
  x=40;
  y=150;
  //sauce shadow
  fill(0, 0, 0, 50);
  ellipse(x, y+28, 35, 15);

  //sauce bottle
  fill(231, 55, 32);
  rect(x, y, 25, 60, 5);
  fill(203, 38, 16);
  rect(x-5, y+2, 8, 50, 5);

  //sauce cap
  fill(255);
  rect(x, y-35.5, 25, 11, 5);
  stroke(255);
  strokeWeight(7);
  line(x, y-43, x, y-35);
  noStroke();
}