variables-lv1

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.

Add 1 to the score variable

Add 1 to the variable named ‘score’

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.

Move "speed" steps. Where speed is a variable.

Move “speed” steps