Use Variables in your game to keep track of something like Lives, Score, Speed, etc.
Note: To earn this Badge, only 1 variable is required. Either Lives, Speed, Health, or anything that uses variables.
What is a Variable
When a video game or computer program wants to keep up with numbers it uses variables.
Variables are used for:
- In Halo, the number of grenades you have.
- In Super Mario Bros, the number of lives you have.
- In The Legend of Zelda, whether or not you have the keyÂ to the next dungeon.
Creating a Variable
Variables for Score
To keep up with a score, Create a variable named ‘score’Â then use the change ‘score’ byÂ block.
Variables for Speed
To make the character’s speedÂ somethingÂ that can vary or can change in-game, Create a variable named ‘speed’.
The speed variable is show below. Instead of moving 10 steps, the character will move “speed” steps.