gameState
string
Tracks which screen is currently displayed: 'intro', 'playing', or 'judging'. Controls the flow of the entire game.
let gameState = 'intro';
foodItems
array
Stores all placed food objects. Each object contains x, y, type, size, and color. This is the core game data.
let foodItems = [];
currentFoodType
string
Tracks which food type the player has selected to place (pea, carrot, cracker, berry, or cheese). Used when dragging.
let currentFoodType = 'pea';
foodTypes
array of objects
Stores definitions for all food types, including their name, default color, draw function, and food group. Used to render foods and populate buttons.
const foodTypes = [{ name: 'pea', draw: drawPea, defaultColor: '#2ECC71', group: 'vegetable' }, ...];
currentFoodColor
string
Stores the hex color code of the currently selected food type. Used when drawing preview items during dragging.
let currentFoodColor = '#2ECC71';
foodSize
number
Base size in pixels for all food items. Multiplied by different values in each food's draw function for variety.
let foodSize = 30;
complimentaryFoodPairs
array of objects
Defines which food types work well together (like cracker + cheese) and how many bonus points they earn when placed close together.
const complimentaryFoodPairs = [{ item1: 'cracker', item2: 'cheese', bonus: 60 }, ...];
PAIRING_DISTANCE_THRESHOLD
number
Maximum pixel distance between two foods for them to be considered a complementary pair. Encourages thoughtful placement.
const PAIRING_DISTANCE_THRESHOLD = foodSize * 2;
TOO_MANY_ITEMS_THRESHOLD
number
Limit on the number of items a player can place. Exceeding this triggers a special scolding feedback message.
const TOO_MANY_ITEMS_THRESHOLD = 200;
startButton
p5.Renderer (button element)
The 'Start Playing' button shown on the intro screen. Triggers startGame() when clicked.
let startButton;
doneButton
p5.Renderer (button element)
The 'Done Playing' button shown during play. Triggers finishPlaying() when clicked.
let doneButton;
clearButton
p5.Renderer (button element)
The 'Clear Plate' button shown during play. Triggers clearPlate() when clicked.
let clearButton;
foodTypeButtons
array of p5.Renderer (button elements)
Stores references to all food type selection buttons (pea, carrot, etc.). Used to show/hide them and highlight the current selection.
let foodTypeButtons = [];
creativityScore
number
The final calculated score based on the player's plate arrangement. Displayed and used to generate feedback.
let creativityScore = 0;
parentFeedback
string
The parental commentary on the player's plate, generated based on the creativity score. Displayed on the judging screen.
let parentFeedback = '';
plateX
number
Horizontal pixel coordinate of the plate's center. Calculated in setup() and updated on window resize.
let plateX, plateY, plateSize;
plateY
number
Vertical pixel coordinate of the plate's center. Calculated in setup() and updated on window resize.
let plateX, plateY, plateSize;
plateSize
number
Diameter in pixels of the circular white plate. Calculated to be 70% of the smaller screen dimension for responsive scaling.
let plateX, plateY, plateSize;