- Your robot game won't be complete without some score!
- In this coding activity we'll be using variables to add more fun to your game.
- Start by clicking Make a Variable button under Data code blocks.
- Name your variable score.
- For all sprites means all sprites in your project know the variable.
Bot Builders : Train Your Robot
Add a score
- First, you'd want to reset your score every time you start your game.
- To do so, drag
set [score v] to below when green flag clickedin your robot sprite.
- Every time you touch the gold coin, increase the score by 1.
change [score v] by (1)inside the If block where your robot touches the color of the gold coin.
- Click the green flag icon and try touching the gold coin.
- To add more challenge, make your score decrease by 1 when you touch the poo.
change [score v] by (-1)insdide the If block where your robot touches the color of the poo.
- Try playing your game! Avoid the poo!