๐ฎ Add a new collectible type
Belly can collect donuts, pizza, ice cream and more. Let's add a new treat! You need to make two small changes โ one to define the new treat, one to let the game spawn it.
// Builder Task 1: add a new kind here! const COLLECTIBLE_RADII = { donut: 16, pizza: 16, icecream: 18, lollipop: 14, hotdog: 18, cupcake: 15, candybar: 16, milkshake: 16, taco: 17, โ add your new treat here! };
spawnCollectible function and add your treat to the kinds array// Builder Task 1: add your new kind name here! const kinds = [ 'donut', 'pizza', 'icecream', 'lollipop', 'hotdog', 'cupcake', 'candybar', 'milkshake', 'taco', โ add this! ];
['donut', 'pizza', ...].
An object stores named values: { donut: 16, pizza: 16 }.
The game picks a random item from the array each time it spawns a collectible.
๐ฅ Add a new Bonkers Mode difficulty tier
The game has Easy, Normal, Hard and Chaos modes. You're going to add a new "Mega" tier that's even more extreme โ and make it appear in the difficulty picker on the title screen.
chaos: { candyCaneRequired: 5, flashDuration: 2.5, shakeDuration: 3.0, runDuration: 7.0, speedMultiplier: 4.2, }, mega: { โ add this new block! candyCaneRequired: 6, flashDuration: 3.0, shakeDuration: 4.0, runDuration: 9.0, speedMultiplier: 5.0, },
<select> and add a new option<select id="bonkers-mode-select"> <option value="easy">Easy</option> <option value="normal">Normal</option> <option value="hard">Hard</option> <option value="chaos">Chaos</option> <option value="mega">MEGA ๐ฅ</option> โ add this! </select>
๐ฏ Make a hitbox more forgiving
A hitbox is the invisible rectangle the game uses to decide if Belly touched an obstacle. Making it smaller means players get more room for error. Let's make the bicycle easier to dodge!
// Hitbox insets: [leftFrac, topFrac, widthFrac, heightFrac] // Smaller widthFrac and heightFrac = smaller hitbox = easier to dodge const OBSTACLE_HITBOX = { // ... 'bicycle': [0.08, 0.20, 0.84, 0.72], // ... };
// Original โ covers most of the sprite 'bicycle': [0.08, 0.20, 0.84, 0.72], // Smaller hitbox โ more forgiving! 'bicycle': [0.22, 0.30, 0.56, 0.50],
[leftFrac, topFrac, widthFrac, heightFrac]
Each is a fraction of the sprite's total size. Bigger left/top fractions push the hitbox inward. Smaller width/height fractions make it narrower and shorter.
โจ Add a new accessory for Belly
Belly can earn accessories by completing perfect runs (no lives lost). Add a brand new accessory to the collection โ it will appear in the shop and can be unlocked just like the others!
// Builder Task 4: add a new object to this array! const ACCESSORIES = [ { id: 'hat', emoji: '๐ฉ', name: 'Magic Hat', desc: 'Tips with style!' }, { id: 'boots', emoji: '๐ข', name: 'Power Boots', desc: 'Spring in every step!' }, { id: 'glasses', emoji: '๐ถ๏ธ', name: 'Cool Shades', desc: 'Looking so groovy!' }, // ... more accessories { id: 'umbrella', emoji: 'โ๏ธ', name: 'Lucky Umbrella', desc: 'Stays dry, plays hard!' }, โ add yours! ];
{ id: '...', emoji: '...', name: '...', desc: '...' }
๐ฆ Move an obstacle to a different level
Each level has its own list of obstacles. The dinosaur normally only appears in level 1, but you can move it โ or add it โ to any other level. You can also make an obstacle appear more often by adding its name to the list more than once!
// Builder Task 5: move names between levels, or add duplicates! const kindsByLevel = { 1: ['toy-small', 'toy-large', 'toy-ball', 'rattle', 'bicycle', 'blocks', 'toy-car', 'dinosaur'], โ try moving this! 2: ['ant', 'worm', 'roman-pot', 'boulder', 'clock'], 3: ['bird', 'balloon', 'plane', 'hot-air-balloon', 'blimp'], // ... };
// Add dinosaur to level 2 as well: 2: ['ant', 'worm', 'roman-pot', 'boulder', 'clock', 'dinosaur'], // Make ants appear twice as often in level 2: 2: ['ant', 'ant', 'worm', 'roman-pot', 'boulder', 'clock'], // Add a sky obstacle to the underground level (chaos mode!): 2: ['ant', 'worm', 'boulder', 'clock', 'bird'],