1. Score board

Score board

We’re going to create a tool that will help you with games: a score board.

Press A to increase the score. Press B when the game has finished.
You’ll be learning:

  • How to display a number.
  • How to keep a score.

Register before you start the exercise. Click the button below and sign up.

Click here

ORIËNTEREN

Bekijk het voorbeeld en denk na over de volgende vragen:

  • Wat moet ik doen?
  • Wat zijn de doelen?
  • Wat zijn de verwachtingen?
  • Wat kan ik al?
  • Wat moet ik nog ontdekken?

Preparation

View the steps at 'perform'. Then answer the following questions:

  • Which steps should I follow?
  • Which steps can I follow?
  • How much time do I need?
  • What tools do I need?

Go!

Do the steps one by one. Do you not remember how to do it? View the hints or download the solution.

STEP 1

Keeping score

Do you want to keep score during a game? Make a score board that increases the number each time you press the button.
Make sure your score appears on the screen

toelichting

There is a separate menu for blocks related to games. You can find this under “Advanced”.
 

If you press the A button, the score has to increase with “1”. You also have to make sure that the score appears on the screen.

Do you already know which blocks you’re going to need? Give it a try.

Did it work? Good job. You can download the code onto your micro:bit. Try it with a friend.

STEP 2

Can you program the B button so that pressing it ends the game? We would also like to see the score at the end.

Try out the programme. You’ll notice your micro:bit keeps repeating the message... “Game Over”.
The block “you’re done” namely repeats this message. You can't give points again.
We can do better! Next, program a “you’re done” block. Make sure that the screen lights up a few times, that it gives you a game over-message, and displays your score.

 

REFLECTION

Look back at the project you just made. Ask yourself the following questions:

  • Does the program work as I expected? Why / why not?
  • What works well?
  • What works less well?
  • How can I approach it differently?

Download

Click on the link below to download a sample solution.