gameState
string
Tracks whether the game is on the start screen ('start') or actively playing ('playing')
let gameState = 'start';
player
object
Stores the player character's position (x, y), radius (r), speed, velocity (vx, vy), and what brainrot is being carried
let player = { x: 200, y: 300, r: 18, speed: 4.2, carrying: null, vx: 0, vy: 0 };
bot
object
Stores the AI opponent's position, radius, speed, velocity, current target (brainrot or base), and cooldown timer for when its base is full
let bot = { x: 200, y: 340, r: 18, speed: 4.2, carrying: null, vx: 0, vy: 0, target: null, noSpaceUntil: 0 };
brainrots
array
Array of all creature objects currently in the game; each tracks position, state flags (rescued, delivered, sold), rarity type, and stored income
let brainrots = [];
money
number
The player's total currency; increases through delivery bonuses, market sales, and passive income collection
let money = 0;
rescuedCount
number
Counter of how many brainrots the player has successfully delivered to their base (displayed in HUD)
let rescuedCount = 0;
baseZone
object
Rectangle defining the player's base storage area (x, y, w, h); brainrots placed here generate passive income
let baseZone = { x: 100, y: 300, w: 220, h: 150 };
playerBaseSlots
array
Array of 8 slot objects where the player can store brainrots; each slot has x, y, and occupied boolean
let playerBaseSlots = [{ x: 100, y: 200, occupied: false }, ...];
botBaseSlots
array
Array of 8 slot objects for the bot's storage, separate from the player's
let botBaseSlots = [...];
runway
object
Rectangle defining the horizontal conveyor-like area where brainrots spawn and walk (x, y, w, h)
let runway = { x: 300, y: 600, w: 800, h: 40 };
marketZone
object
Rectangle defining the area where the player can instantly sell a carrying brainrot for its market value
let marketZone = { x: 1000, y: 400, w: 180, h: 130 };
upgradeZone
object
Circle defining the speed boost power-up zone with x, y, and radius r; walking over grants +0.3 speed with 8-second cooldown
let upgradeZone = { x: 640, y: 360, r: 40 };
maxBrainrotsOnMap
number
Maximum number of creatures allowed on the runway at once; controls game difficulty and pacing
let maxBrainrotsOnMap = 10;
spawnInterval
number
Milliseconds between brainrot spawn events; lower values increase spawn frequency and income growth
let spawnInterval = 2000;
lastSpawnTime
number
Timestamp (in ms) of the last brainrot spawn; used to track if enough time has passed to spawn another
let lastSpawnTime = 0;
lastPassiveTime
number
Timestamp of the last passive income calculation; used to compute delta time for frame-independent income accumulation
let lastPassiveTime = 0;
lastUpgradeTime
number
Timestamp of the last speed upgrade activation; used to enforce the 8-second cooldown between upgrades
let lastUpgradeTime = 0;
upgradeCooldown
number
Milliseconds required between consecutive speed upgrades (8000 = 8 seconds)
const upgradeCooldown = 8000;
playerUpgradeFlashUntil
number
Timestamp until which the player should be rendered in green (visual feedback for upgrade activation)
let playerUpgradeFlashUntil = 0;
showIndex
boolean
Whether the brainrot encyclopedia overlay is currently visible (toggled by pressing I)
let showIndex = false;
indexScroll
number
Vertical scroll offset (in pixels) for the index panel, allowing mouse wheel scrolling through all creatures
let indexScroll = 0;
collectFlashUntil
number
Timestamp until which the '+$X' income collection text should be displayed (800ms flash)
let collectFlashUntil = 0;
lastCollectAmount
number
The amount of money collected in the last income harvest (displayed in the flash text)
let lastCollectAmount = 0;
noSpaceUntil
number
Timestamp until which the 'You don't have space!' warning should be shown (3 seconds after failed delivery)
let noSpaceUntil = 0;
brainrotTypes
array
Master list of all creature types with their names, rarities, and computed properties (incomePerSecond, marketValue)
const brainrotTypes = [{ name: 'Strawberry Elephant', rarity: 'OG' }, ...];
rarityValueRanges
object
Lookup table mapping rarity tiers to [minPrice, maxPrice] ranges for market value generation
const rarityValueRanges = { Common: [25, 1700], Legendary: [35000, 345000], ... };
rarityIncome
object
Lookup table mapping rarity tiers to default per-second income rates (overridden by customIncome for unique creatures)
const rarityIncome = { Common: 1, Rare: 3, Epic: 7, ... };
customIncome
object
Special per-second income rates for individual named creatures (e.g., 'Strawberry Elephant': 750000000)
const customIncome = { 'Strawberry Elephant': 750000000, ... };
rarityLabelColors
object
Lookup table mapping rarity tiers to [R, G, B] text color arrays for index display
const rarityLabelColors = { Legendary: [255, 240, 130], OG: [255, 180, 255], ... };
rarityGlowColors
object
Lookup table mapping rarity tiers to [R, G, B] glow effect color arrays (null for special rarities)
const rarityGlowColors = { Rare: [120, 170, 255], OG: [255, 215, 0], ... };
rarityBodyColors
object
Lookup table mapping rarity tiers to [R, G, B] body color arrays for creature rendering
const rarityBodyColors = { Epic: [190, 100, 255], OG: [255, 215, 0], ... };