Discuss Scratch

girlwithalltheroses
Scratcher
5 posts

How do I use cloud variables?

I just want to know. My games would be better
(☁ score)
semantically
Scratcher
42 posts

How do I use cloud variables?

Well, you first need to create one in your code. Once you've done that, you can use the cloud variable like a normal variable: changing it, setting it, using it for something, and more! The only difference is that the value of the cloud variable which can only be numbers is the same for everyone using the project. That means when one person's code updates the value, it will change to that value for everyone else, too. It only works for scratchers, not new scratchers, and you have to be signed in to use them.
NotK3ndricAlt
Scratcher
1000+ posts

How do I use cloud variables?

High scores!
when green flag clicked
forever
if <(Score) = (☁ High Score)> then
set [☁️ High Score v] to (Score)
end
end
Or even an online clicker game where you need to get a billion score by 2025!
when this sprite clicked
if <(current [year v]) < [2025]> then
change [☁️ Score v] by (1)
end
when green flag clicked
if <(current [year v]) > [2024]> then
if <(☁️ Score) > [999999999]> then
say [Good job] for (2) secs
end
end
Uhh, what…
Whatever you can imagine with cloud variables!

Last edited by NotK3ndricAlt (May 30, 2024 13:12:22)

BigNate469
Scratcher
1000+ posts

How do I use cloud variables?

To add on to what @semantically said, they can only update every 1/10th of a second. Scratch updates its screen at 30fps (one frame per 1/30th of a second) at maximum. As a result, a lot of multiplayer games appear to lag, when in fact they're just updating at 10Hz.
Hz a short version of Hertz, which is a unit that means “number of times per second”. Your computer's processor likely completes operations at more than 1 billion Hz, or 1 gigahertz- a billion operations per second.

Powered by DjangoBB