gameState
string
Tracks whether the game is on the start screen ('start') or actively playing ('playing')
let gameState = 'start';
player
object
Stores the player object with position (x, y), radius (r), speed, carrying state, and velocity (vx, vy)
let player = { x: 100, y: 100, r: 18, speed: 4.2, carrying: null, vx: 0, vy: 0 };
brainrots
array
Array of all brainrot objects in the game, each with position, state flags, type, income, etc.
let brainrots = [];
baseZone
object
Defines the base's rectangular zone (x, y, width, height) where brainrots are stored
let baseZone = { x: 50, y: 200, w: 220, h: 150 };
baseSlots
array
Array of 8 inventory slot objects, each with position (x, y) and occupied status
let baseSlots = [];
runway
object
Defines the runway zone (x, y, width, height) where brainrots spawn and walk
let runway = { x: 200, y: 450, w: 800, h: 40 };
marketZone
object
Defines the market zone (x, y, width, height) where brainrots can be sold
let marketZone = { x: 1100, y: 250, w: 180, h: 130 };
rescuedCount
number
Total number of brainrots the player has delivered to the base
let rescuedCount = 0;
maxBrainrotsOnMap
number
Maximum number of unrescued brainrots that can exist on the runway at once (default 10)
let maxBrainrotsOnMap = 10;
spawnInterval
number
Milliseconds between brainrot spawns (default 2000 = 2 seconds)
let spawnInterval = 2000;
lastSpawnTime
number
Timestamp (in ms) of the last brainrot spawn, used to rate-limit spawning
let lastSpawnTime = 0;
money
number
Player's total accumulated money from rescuing and selling brainrots
let money = 0;
brainrotReward
number
Instant cash awarded when delivering a brainrot to the base for the first time (default 100)
const brainrotReward = 100;
lastPassiveTime
number
Timestamp (in ms) of the last passive income update, used to calculate time deltas
let lastPassiveTime = 0;
showIndex
boolean
Whether the Brainrot Index overlay panel is currently visible (toggled by pressing I)
let showIndex = false;
indexScroll
number
Vertical scroll offset for the Index panel (negative value scrolls down)
let indexScroll = 0;
indexMaxScroll
number
Maximum scroll distance for the Index panel, calculated based on content height
let indexMaxScroll = 0;
indexPanelBounds
object
Stores the Index panel's bounding box (x, y, w, h) for mouse interaction detection
let indexPanelBounds = null;
noSpaceUntil
number
Timestamp when the 'no space' warning expires (set when base is full)
let noSpaceUntil = 0;
lastCollectAmount
number
Amount of income just collected, displayed as a green flash in the HUD
let lastCollectAmount = 0;
collectFlashUntil
number
Timestamp when the income collection flash expires
let collectFlashUntil = 0;
saveButton
object
Reference to the HTML save/load button for DOM manipulation
let saveButton;