How To Use Cloud Variables In Scratch Programming

How To Use Cloud Variables In Scratch Programming [Explained]

By Arun Gupta
Home » Code for Kids Corner » How To Use Cloud Variables In Scratch Programming [Explained]

Hey! Scratchers, I hope you are all doing good. In this blog, I brought the solution for How to use cloud variables in Scratch?

Let’s learn together and understand how it works. 

Before starting to do anything on Scratch we need to log in first, if you don’t know how to log in or create an account on Scratch please read my first blog.

Scratch Coding

Let’s begin with the solution to the above question. Firstly we will understand what is variable and what is cloud variable? 

What is a Variable in Scratch? 

A variable is a value that can store and change, depending on conditions or on information passed to the program. It could be any value like a number, quantity that can be measured or counted. 

Steps to create Variables in Scratch 

  • Open the Scratch editing page or click on create and start making your new project as per your choice. 
  • Design your project whatever idea you have and want to make. 
  • As you have completed the design, do the code according to the need of your project. 
  • It’s our turn to understand if our project is showing ‘score’, ‘lives’, ‘number’, or anything like “integer” then we are on the right step because we need to create a variable to display all changes in score or lives. 
  • To create a variable we have to click on the variable block and name your new variable according to your choice. 

NOTE: If you are creating a variable for all sprites then you have to select for all sprites just below the variable name while creating or click on for this sprite only if you are only creating for a single sprite.

Please see the images below for reference.

How To Use Cloud Variables In Scratch Programming

Now let’s understand what a Cloud Variable is. 

What are Cloud Variables in Scratch? 

Cloud variables in Scratch are nothing but simple variables with advanced features. 

In the cloud variable, we can store the values or data on Scratch’s server that will also store your changes whenever it happens in your projects. 

Checkout coding classes for kids to learn coding for kids.

Understand Cloud Variables in Scratch with a small project. 

Note: Cloud variable may not be available for new Scratchers. 

Today we are creating a balloon pop game to understand how to use cloud variables in Scratch. 

STEP1: Sprite and Backdrop

  • Choose your first sprite as a balloon (you can change it as per your choice) and set the size of it. 
  • If you want to make it more interactive then choose a backdrop as per your choice. 
  • We only need these two things in this game, we are done with the designing part let’s do a code. 

STEP2: Let’s do the code for the game. 

  • Select your sprite (Balloon) and start with the first code by choosing when the green flag clicks from the event block.
  • We will make the balloon go to the random position of the green flag as clicked. 

Choose to go to a random position from the motion block and place it just below the green flag, but as you can see, the balloon will only move once to a random position. To make it move all over the stage without stopping, proceed to the next step.

How To Use Cloud Variables In Scratch Programming
  • Now pick the forever block from the control block. 
  • Now take go to random position and put it inside the forever block. 

It will make a balloon move all over the stage and don’t forget to put the wait 1-sec block otherwise your balloon will move very fast

How To Use Cloud Variables In Scratch Programming
  • Now we will create a cloud variable from a variable block. Go to the variable and click on create a variable and write the variable name (anything) and select cloud variable and hit ok. 

Uncheck the variable name from the variable block to make it invisible. 

Note: Don’t forget to click on the cloud variable.

How To Use Cloud Variables In Scratch Programming
  • Similarly, create one more simple variable (Highest score) that will display our cloud variable data into it to better understand cloud variable storage.
  • Now choose the set Highest score and score (Cloud) with the green flag. Every time we restart the game, the score will be reset to zero.

Note: cloud variables can only store numbers and values, not letters.

  • Now set the Highest score variable to the cloud variable to display the score when we pop the balloon. 
How To Use Cloud Variables In Scratch Programming

The next step is to get the score when we pop the balloon. Choose when this sprite clicks from the event block and go to the variable and pick change cloud score change by 1 similarly we will pick set highest score to cloud score.

Please see the image for reference.

How To Use Cloud Variables In Scratch Programming

Learn more about python coding for kids in this article.

Conclusion

We are done with the game and now play the game and enjoy it. Variables are a crucial concept in coding. 

Variables in scratch coding for kids are classified into three types: local variables, global variables, and cloud variables. 

I hope you now understand what a cloud variable is after reading this. If you’ve learned how to use cloud variables in Scratch don’t forget to apply them to your next project.

Learn Scratch at BrightChamps with its specially designed curriculum that makes learning programming easy for students in Grade 1-12.

BrightChamps also teaches a variety of other programs that help kids build a foundation in computer programming through activities, interactive lessons, and other means which they can apply in real-life projects like building apps and games, website maker for kids, etc.

Arun Gupta

⭐⭐⭐⭐⭐

I am a child psychologist as well as a teacher, and I love what I do. My strongest skill is observation, and I enjoy developing new ideas into apps. My goal at BrightChamps is to help children improve their IT skills in order to better prepare them for the future. Learn from Me

Reach Us

Categories

General Sidebar Widget Coding

Get a Talent Discovery Certificate after trial class

100% Risk-Free. No Credit Card Required

Related Articles

Trending Articles