how to use VALUES (aka variables)
So values might be slightly complicated, but they’re the most helpful block I’ve ever used (in my opinion).
What are values?
They’re the light yellow blocks, by the math operations.
They’re also known as variables but ima just call them values.
You use the yellow Variable blocks to set the value to a certain number.
What do they do?
Ok I don’t know how to do this without an analogy lol so…
So Lola wants to tell all the shapes to turn a random color when the iPad is shaken, and she only wants the shapes to change color once.
She can’t use When: iPad Is Shaken because if the iPad was shaken more than once, the shapes would change color more than once, and Lola only wants the shapes to change color once.
She can solve this with values. How?
Welp I haven’t gotten to the tutorial yet and that’s where I’ll say how.
So let’s say you’re the Lola from that story above. You have to make the shapes change color only once.
Now you could use a When: iPad Is Shaken “when” block, but that would allow the shapes to change color more than once. That wouldn’t work, you only want the shapes to change color once.
Or you could drag out another object — let’s say Chillana, and add the code below as Chillana’s code.
And that code will let the shapes know when the iPad is shaken, and using values and the code below, the shapes will know to only change color once — when Value 1 equals 1, the shapes will change color, then set Value 1 to 2, and they won’t change color again because of the Check Once If (Value 1) does not equal (2)
The Check Once If tells Chillana to not set Value 1 to 1, if Value 1 already equals 2.
So concluding, values can help your objects tell another object to do (or not to do) a certain movement, color change, size change, etc.
Sorry if this wasn’t clear!
was this helpful?
Feel free to ask any questions you have!!