Bot Builders : Train Your Robot

Add a score


1
  1. Your robot game won't be complete without some score!
  2. In this coding activity we'll be using variables to add more fun to your game.
  3. Start by clicking Make a Variable button under Data code blocks.
  4. Name your variable score.
  5. For all sprites means all sprites in your project know the variable.

2
  1. First, you'd want to reset your score every time you start your game.
  2. To do so, drag set [score v] to [0] below when green flag clicked in your robot sprite.

3
  1. Every time you touch the gold coin, increase the score by 1.
  2. Attach change [score v] by (1) inside the If block where your robot touches the color of the gold coin.
  3. Click the green flag icon and try touching the gold coin.

4
  1. To add more challenge, make your score decrease by 1 when you touch the poo.
  2. Attach change [score v] by (-1) insdide the If block where your robot touches the color of the poo.
  3. Try playing your game! Avoid the poo!

NEXT