Count the coins in your game

ReadingKeeping count

Now put a counting script into your own game. It counts the coins on level 1 and cheers the player on.

​
if
end
if
end

How to read it

LinesWhat they do
when any {Heroes} enters and @coins is 0When the level starts, the count is set to 0
when any {Heroes} collects a coinThis rule runs for each coin
@coins goes up by 1Adds 1 to the count
@left is 30 - @coinsWorks out how many are left
if @left is 15Halfway: half of 30 is 15
if @left is 0None left: every coin is found

Give it to your level

  1. Press Copy, at the bottom of the script in the code box above.
  2. Open your game in the builder below, on level 1.
  3. Press the Map button Map settings, under the map.
  4. At the bottom of the level's settings, press Level script.
  5. Press Code Code, and paste the script in. Press Save Save.

This makes a new game in your Lab and opens the builder right here. It is free.

Try it

Press Play Play game and collect your coins. A banner shows when you are halfway, and again when you have them all.

Make it fit your level

The script has two numbers that depend on your total: 30 and 15. If your level has a different total, change both.

Your totalHalfwayThe sum
301530 ÷ 2
241224 ÷ 2
402040 ÷ 2