Tutorial: Add collectibles and scoring
Add coins and diamonds that players collect for points. Bali generates the art and sound, writes the logic, and helps you debug it when something doesn’t work the first time.
Cave arcade game, part 4 of 6. Each part builds on the one before. See all tutorials.
You’ll learn how to: describe a new mechanic so Bali gets it right, generate images and sounds as part of a feature, and use on-screen labels and logs to track down a bug.
Prefer to watch? Play the full video (15 min)
Step 1: Describe the mechanic in detail
Section titled “Step 1: Describe the mechanic in detail”For a new feature, the more specific your prompt, the better Bali’s first attempt. Say what the player collects, what each item is worth and where it should appear. The video uses this prompt:
I want to add a collectible mechanic. Can you generate some coins and jewels as images? I want a gold coin that’s worth 100 points, and a diamond that’s worth 200 points that I can put in different rows. If the player collects them it will add to their score.

Step 2: Generate the collectible images
Section titled “Step 2: Generate the collectible images”The asset generator opens with a request for each item and a prompt Bali wrote. Under Advanced Options you can see where each file will be saved and its size. Remove Background is turned on, so the items blend into the game. Edit the prompts if you like, then click Generate.

Step 3: Add a pickup sound
Section titled “Step 3: Add a pickup sound”Once the images are done, Bali carries on with the feature and asks for a sound effect to play when the player collects an item. Play the sound in the card to preview it. If you want something different, change the prompt and generate it again. Click Done to move on.

Step 4: Let Bali write the logic
Section titled “Step 4: Let Bali write the logic”With the art and sound ready, Bali already knows what the mechanic should do. It writes the code for detecting when the player touches an item, awarding points and updating the score.
Step 5: Choose where the items appear
Section titled “Step 5: Choose where the items appear”Bali pauses to ask how the items should spawn. It suggests options such as fixed positions, patterns along rows, or items that move.

Step 6: Start simple
Section titled “Step 6: Start simple”Begin with items that don’t move. The player has to time their run, dodge the obstacles and pass through the item’s position to pick it up.
Step 7: Playtest and spot the problem
Section titled “Step 7: Playtest and spot the problem”On the first test, only one coin appears on screen, so something in the spawn logic isn’t right yet. Describe exactly what you see when you tell Bali.
Step 8: Debug with labels and logs
Section titled “Step 8: Debug with labels and logs”Ask Bali to add logging and to label each coin on screen, so you can see which coins spawn and where. In the video, the labels showed that some coins were spawning in the danger zone, so Bali moved them into rows with obstacles or platforms. When everything works, ask Bali to remove the debug labels.

Step 9: Nudge the positions
Section titled “Step 9: Nudge the positions”Small adjustments are quick to ask for. The video moves the coins up slightly so they sit in the middle of their rows and feel better to run through.
Step 10: Add a second item with a different rule
Section titled “Step 10: Add a second item with a different rule”Now add diamonds with their own spawning rule: they stay on the moving platforms they spawn on, so the player has to get onto the right platform to collect them.

Step 11: Refine until it’s right
Section titled “Step 11: Refine until it’s right”A second mechanic layered on top of the first takes more back and forth. Keep refining your prompts until it works. In the video, it takes a few rounds before all three diamonds spawn and move the way they should.
Step 12: Playtest, then publish
Section titled “Step 12: Playtest, then publish”Play the game again in the Preview tab. When everything looks good, publish the updated game.

