function drawEatingScene() {
// NEW: Check for win condition
if (eatingSceneStartTime > 0) {
let elapsedTime = millis() - eatingSceneStartTime;
if (elapsedTime >= targetWinDuration) {
winTimeTaken = elapsedTime; // Store the time taken to win
sceneState = WIN_SCENE;
return; // Exit draw to immediately show win screen
}
}
// Display instructions
fill(0);
text("Tap to 'eat' 🌭", width / 2, height / 4);
// Display hotdog count
fill(0);
text(`Hotdogs Eaten: ${hotDogCount}`, width / 2, height / 4 - 40);
// Display money
fill(0);
text(`Money: $${money}`, width / 2, height / 8);
// Shop Button
let shopButtonWidth = 100;
let shopButtonHeight = 40;
let shopButtonX = width - shopButtonWidth / 2 - 20; // Top-right position
let shopButtonY = height / 8;
fill(100, 100, 255); // Blue
rect(shopButtonX, shopButtonY, shopButtonWidth, shopButtonHeight, 10);
fill(255);
text("Shop", shopButtonX, shopButtonY);
// Draw the "hot dog"
let hotDogLength = map(fullness, 0, maxFullness, 50, 200);
let hotDogWidth = 30; // Fixed width for the hot dog
let hotDogY = height / 2;
let hotDogCenterX = width / 2;
// Draw the bun
fill(255, 220, 150); // Light brown for the bun
rect(hotDogCenterX, hotDogY, hotDogLength + 20, hotDogWidth + 10, 10); // Rounded rectangle for bun
// Draw buns ends
ellipse(hotDogCenterX - (hotDogLength / 2 + 10), hotDogY, hotDogWidth + 10, hotDogWidth + 10);
ellipse(hotDogCenterX + (hotDogLength / 2 + 10), hotDogY, hotDogWidth + 10, hotDogWidth + 10);
// Draw the actual hot dog
fill(160, 82, 45); // Sausage brown color
rect(hotDogCenterX, hotDogY, hotDogLength, hotDogWidth, hotDogWidth / 2); // Rounded rectangle for hot dog
// --- Add Ketchup and Mustard ---
let condimentYOffset = hotDogY - hotDogWidth / 2 + 5; // Draw slightly above the hot dog
let condimentWidth = 5; // Thickness of the condiment lines
let halfDogLength = hotDogLength / 2;
// Ketchup (Red)
fill(255, 0, 0);
beginShape();
curveVertex(hotDogCenterX - halfDogLength, condimentYOffset); // Control point (off-screen left)
curveVertex(hotDogCenterX - halfDogLength, condimentYOffset); // Start point
curveVertex(hotDogCenterX - halfDogLength * 0.8, condimentYOffset + condimentWidth * 0.5);
curveVertex(hotDogCenterX - halfDogLength * 0.5, condimentYOffset - condimentWidth * 0.5);
curveVertex(hotDogCenterX - halfDogLength * 0.2, condimentYOffset + condimentWidth * 0.5);
curveVertex(hotDogCenterX, condimentYOffset - condimentWidth * 0.5);
curveVertex(hotDogCenterX + halfDogLength * 0.2, condimentYOffset + condimentWidth * 0.5);
curveVertex(hotDogCenterX + halfDogLength * 0.5, condimentYOffset - condimentWidth * 0.5);
curveVertex(hotDogCenterX + halfDogLength * 0.8, condimentYOffset + condimentWidth * 0.5);
curveVertex(hotDogCenterX + halfDogLength, condimentYOffset); // End point
curveVertex(hotDogCenterX + halfDogLength, condimentYOffset); // Control point (off-screen right)
endShape();
// Mustard (Yellow)
fill(255, 200, 0);
beginShape();
curveVertex(hotDogCenterX - halfDogLength, condimentYOffset + condimentWidth * 1.5); // Control point (off-screen left)
curveVertex(hotDogCenterX - halfDogLength, condimentYOffset + condimentWidth * 1.5); // Start point
curveVertex(hotDogCenterX - halfDogLength * 0.7, condimentYOffset + condimentWidth * 2);
curveVertex(hotDogCenterX - halfDogLength * 0.4, condimentYOffset + condimentWidth * 1);
curveVertex(hotDogCenterX, condimentYOffset + condimentWidth * 2);
curveVertex(hotDogCenterX + halfDogLength * 0.4, condimentYOffset + condimentWidth * 1);
curveVertex(hotDogCenterX + halfDogLength * 0.7, condimentYOffset + condimentWidth * 2);
curveVertex(hotDogCenterX + halfDogLength, condimentYOffset + condimentWidth * 1.5); // End point
curveVertex(hotDogCenterX + halfDogLength, condimentYOffset + condimentWidth * 1.5); // Control point (off-screen right)
endShape();
// --- End Ketchup and Mustard ---
// Display fullness level
fill(0);
text(`Fullness: ${floor(fullness)} / ${maxFullness}`, hotDogCenterX, hotDogY + hotDogWidth / 2 + 50);
// Passive fullness generation if people are hired
if (peopleCount > 0) {
updateFullness(peopleCount * 0.005); // 0.005 fullness per person per frame
}
// Display people count and draw them
fill(0);
text(`People: ${peopleCount}`, width / 2, height * 0.75 - 30); // Text above the people
let startX = width / 2 - (peopleCount - 1) * 20; // Center the people
for (let i = 0; i < peopleCount; i++) {
drawPerson(startX + i * 40, height * 0.75); // Draw each person in a row
}
// Draw the "poop" trails
for (let i = 0; i < poopHistory.length; i++) {
let poop = poopHistory[i];
fill(poop.color);
// Draw a trail of small ellipses
for (let j = 0; j < poop.trail.length; j++) {
let p = poop.trail[j];
ellipse(p.x, p.y, p.size, p.size);
}
// Fade out the poop over time
poop.alpha -= 5;
if (poop.alpha <= 0) {
poopHistory.splice(i, 1); // Remove faded poop
i--;
}
}
// Display UFO cooldown
if (!ufoActive && millis() - ufoCooldownTimer < ufoCooldownDuration) {
let cooldownLeft = floor((ufoCooldownDuration - (millis() - ufoCooldownTimer)) / 1000);
fill(255, 100, 0); // Orange
textSize(20);
text(`UFO Cooldown: ${cooldownLeft}s`, width / 2, height * 0.9);
textSize(24); // Restore default textSize
}
}