/*
Burger Kitchen: An Interactive Toy, By Dylan Montgomery
October 3rd 2018
> Move patty to the frying pan
> Wait for patty to cook
> Move frying pan to counter
> Move patty to plate
> Flip switch to check burger
> Flip switch back to reset
some inspiration drawn from Test_Drag example for how to click and drag objects
*/
boolean burgerBun = false;
boolean lettuce = false;
boolean tomato = false;
boolean pickles = false;
boolean isPanOnElement = true;
boolean isPattyOnBox = true;
boolean isPattyInPan = false;
boolean isPanOnCounter = false;
boolean isPattyPickedUp = false;
boolean isPanPickedUp = false;
boolean isPattyOnPlate = false;
float panX = 104;
float panY = 87;
float handleX = 14;
float handleY = 77;
float r = 255;
float g = 100;
float b = 100;
float lr = 0;
float lg = 0;
float lb = 0;
void setup()
{
//Set screen size
size(400, 400);
}
void draw()
{
background(150);
//
//Stove Top
//
fill(50);
rect(45, 25, 125, 125);
fill(15);
ellipse(104, 87, 80, 80);
stroke(100, 150, 255);
strokeWeight(5);
ellipse(104, 87, 50, 50);
stroke(20);
strokeWeight(10);
//bottom left
line(60, 125, 90, 95);
//bottom right
line(120, 95, 150, 125);
//top left
line(60, 45, 90, 70);
//top right
line(150, 45, 120, 70);
stroke(0);
strokeWeight(1);
//
//Frying Pan
//
if (isPanOnElement == true)
//set drawing co-ordinates for positioning the pan on the element
{
fill(0);
rect(14, 77, 50, 20);
fill(130);
ellipse(104, 87, 95, 95);
noStroke();
fill(100);
ellipse(104, 87, 80, 80);
stroke(1);
} else if (isPanPickedUp == true)
//fixing the pan's position to mouse input for when it is picked up
{
fill(0);
rect(handleX + mouseX, handleY = mouseY, 50, 20);
fill(130);
ellipse(panX + mouseX, panY = mouseY, 95, 95);
noStroke();
fill(100);
ellipse(panX + mouseX, panY + mouseY, 80, 80);
stroke(1);
} else if (isPanOnCounter == true)
//set co ordinates for pan placed on counter off the element
{
}
//
//Patties
//
if (isPattyOnBox == true)
//positioning for patty on the supply box
{
fill(100);
rect(45, 225, 125, 125);
fill(r, g, b);
ellipse(104, 290, 50, 50);
} else if (isPattyInPan == true)
//positioning for patty in the frying pan
{
} else if (isPattyPickedUp == true)
//fixing patty to mouse movement
{
} else if (isPattyOnPlate == true)
//positioning patty on plate
{
}
//
//Plating
//
fill(175);
rect(200, 225, 125, 125);
fill(255);
ellipse(263, 288, 110, 110);
ellipse(263, 288, 90, 90);
//
//Counter
//
fill(200);
rect(200, 25, 125, 125);
//
//Switch
//
fill(175);
rect(340, 250, 50, 80);
//
//Light
//
fill(175);
ellipse(365, 30, 50, 50);
fill(lr, lg, lb);
ellipse(365, 30, 40, 40);
//
//Garbage bin
//
fill(175);
rect(340, 100, 50, 120);
fill(0);
rect(345, 105, 40, 110);
//
//Edge
//
fill(120);
rect(-1, 380, 401, 20);
//loop to create striated line effect on counter's edge
for (float i = 0; i < width + 20; i += 5)
{
line(i, 380, i - 10, height);
}
}
void cookingPatty()
{
//iterate the coloration of the patty, so that it changes from an undercooked pink,
//to a properly cooked brown, then to an overcooked black
if (isPattyInPan == true && isPanOnElement == true)
{
r -= 2.5;
g--;
b--;
}
}
void preparePlating()
//randomly determine burger plating components, i.e. no tomato
{
if (random(1) > 0)
{
burgerBun = true;
}
if (random(1) > 0)
{
lettuce = true;
}
if (random(1) > 0)
{
tomato = true;
}
if (random(1) > 0)
{
pickles = true;
}
}
void checkPatty()
{
if (r > 40 && r < 90)
//use the coloration of the patty to determine if its cooked properly, or under/overcooked
{
//if patty is cooked properly, turn light green
lg = 255;
}else
{
//turn light red
lr = 255;
}
//return light to black after
lg = 0;
lr = 0;
}
void mousePressed()
{
//Pick up the patty
if (mouseX > 79 && mouseY > 265 && mouseX < 129 && mouseY < 315 && !isPanPickedUp && !isPattyPickedUp)
{
isPattyPickedUp = true;
println("patty is picked up");
}
//Pick up the frying pan
if (mouseX > 14 && mouseY > 77 && mouseX < 64 && mouseY < 97 && !isPattyPickedUp)
{
isPanPickedUp = true;
println("pan is picked up");
}
//Put the patty in the pan
if (mouseX > 64 && mouseY > 47 && mouseX < 144 && mouseY < 127 && isPanOnElement == true && isPattyPickedUp == true)
{
isPattyPickedUp = false;
isPattyInPan = true;
}
//Put the frying pan on the counter
if (mouseX > 200 && mouseY > 25 && mouseX < 325 && mouseY < 150 && isPanPickedUp == true)
{
isPanPickedUp = false;
isPanOnCounter = true;
}
//Switch flip
if (mouseX > 340 && mouseY > 250 && mouseX < 390 && mouseY < 300)
{
checkPatty();
}
}