Part 6: Score and lives

Steps 21 to 25. Add a Score and a Lives object, give points for bricks, lose a life when the ball escapes, and restart when lives run out.

Chocobreak โ€” NutHouse
The properties panel for the Score object in Chocobreak
The Score object shows Player 1โ€™s score. It needs no rules of its own.

What this part teaches

Score and Lives are not sprites. They are objects that show a number the game keeps. The number belongs to โ˜บ Player 1, which has its own column in the Events tab. You also meet the ๐ŸŽฌ Game column, and write a rule with two actions in two different columns.

Step 21: Keep score

  1. Go back to the Level tab.
  2. Press + Add object, click New, then Score.
  3. Drag it to the top-left corner.

Step 22: Points for every brick

  1. In Events, find the row where the Ball collides with the Brick.
  2. Click under โ˜บ Player 1 and choose Add to score.
  3. Type 10 and press Add.
Add to score

You added an action to a rule you already had. Now one touch does three things: destroy, bounce, add 10.

Step 23: Three lives

In the Level tab, press + Add object, New, then Lives. Put it in the top-right corner. The number of lives you start with is in Lives at start, on the right.

Step 24: Losing a life

  1. Press + New event, click Ball, then Leaves the play area, tick only Bottom, press Add.
  2. Under โ˜บ Player 1 choose Subtract lives, with 1.
  3. Under Ball choose Set position. Type X 0, Y -24, and set Measured from to the Paddle.
Set position

โ€œMeasured from the Paddleโ€ puts the ball 24 pixels above wherever the paddle is right now, so it always comes back to you.

Step 25: Game over

  1. Press + New event, click โ˜บ Player 1, then Compare the number of lives. Pick = equal to and 0. Press Add.
  2. Under ๐ŸŽฌ Game choose Restart the game.
Compare the number of lives
WhenPlayer 1 lives = 0
DoRestart the game

Next: Part 7: Winning and saving.

Still stuck?

Try the Chocobreak tutorial, open a sample game and read its rules, or look at the questions people ask.