Discuss Scratch

Apyanimator
New to Scratch
5 posts

Variable

Will anyone pls tell me how variables work?I read the instructions,but just can't get it.
danielhal
Scratcher
100+ posts

Variable

to make a variable press ‘create variable’ then type it's name. Next decide if it's for all sprites, meaning they all can use it/modify it or if it's exclusive to the sprite you are in the code of at the time. Next, cloud variables (Which you can't access until your no longer ‘new’). They are a special kind of variable that are the same for everyone,only support numbers (currently) and not reset after page refreshes. Only non-new scratcher's can use/modify this type of variable.

Next, the usage of a created variable. First of all, the tick box next to the variable name is the thing that determines it's visibility If there's a tick, it shows, if there's not, it doesn't. This tick can be changed by using either:
1. the mouse by clicking the box
2. the blocks:
show variable [ v]
hide variable [ v]
which do as their names suggest.
Variable's main uses are with the operator blocks:
(() + ())
(() - ())
(() * ())
(() / ())
<[Score] = [40]>
<[Score] > [10]>
and so on…

How to change a variable:
1. Using the blocks:
set [Score v] to [0]
change [Score v] by (1)
The change by block adds the new number to the old variable number, malfunctions if the variable is not a number.
The set variable block sets the variable to what you type (supports words).

If you don't understand, just say which bit you don't, and I'll try make it easier to understand If there's anything I missed, please say!

Last edited by danielhal (June 3, 2014 16:15:16)

JUNIORBHT
Scratcher
35 posts

Variable

see the Wiki Page

My LevelEditor is awesome!

Powered by DjangoBB