Variables

We can understand variables as a "name" that contains a "value." We can assign a value to the variable. And we can recover the value of the variable. When you make a new variable, these variable control blocks appear in "Variables".

imagen.png

Practical case:

Open a new file. 

Make a new variable and call it "SCORE"

Solution

imagen.png

Variables as you have seen can be created to be recognizable and usable for all sprites (global), or only for a certain sprite (local). The first case is the usual, although in cases such as counter variables it may not be necessary for them to be global if they are only going to be used by a single sprite.

Let's add some more complexity.

Solution

imagen.png

Save the file with the name variables.sb3


Revision #4
Created 24 November 2023 21:15:42 by Ana López Floría
Updated 10 January 2025 13:58:24 by Ana López Floría