top of page

1. Variables

Variables are a programmers best friend. They store information like numbers (integers & floats) and letters (strings). To create a variable got to the variables category and click the "Make a Variable" button. A box will pop up asking you to name your variable. There will be two options below that saying "For all sprites" and "For this sprite only". If you select "For all sprites" the variable will be shared across all the sprites. If you choose "For this sprite only" the variable will only be visible to the sprite that you are creating the variable in. Select "For all sprites" and hit OK. In the variables menu, tick the box next to your variable. This will show it. Next make two sprites. In one of them drag out a "when this sprite clicked" and pop a "change [variable name] by 1". In the other sprite do the same except set the "change [variable name] by 1" to be -1. When you run your code and click on your sprites you should get something like this.

To see how to make a better, more advanced number counter go to youtube.com/watch?v=XDmyz3fm-KE

Variable.gif
Arrow Sketch
bottom of page