Hello! This is about the yellow blocks:
They change variables, usually things that are meant to change by increasing or decreasing or being set. They can be handy, like being used in art pads, tappers or games where you have increasing/decreasing/changing values.
Set Block
You know the “set” block? That’s used to set a variable. To use it, select it and add it to your code. For this instance, we’ll put it under “When Game Starts”.
You might be thinking, “what now?”. Well,let’s create a variable under the IPad text. Just name it Variable.
Now you have created the variable. Set it to any value. I’m leaving it at the default, ten.
But wait. What happens now? Well, let’s make the variable cause something to happen. Let’s use the blue Check Once If blocks. Set it so when Variable is equal to ten, it changes the text to “Congrats!” It should how look like this:
Press play now. It should say “Hooray”, or whatever you set it to.
Hope this helps. Now, you should be able to make something using a set block if you didn’t know what it did. That’s ok- we all learn something new!
Increase Block
Don’t know how to use the increase block? Let’s continue off the previous tutorial. With the code from the “hooray text”, change the Check Once If Block to when Variable is equal to 15. Then, add the code for when self is tapped. Add the increase block. Be sure to put in the variable!
Change it so it increases by 5 when tapped.
Now make sure before you play, have the text say Tap Me.
If you play now, it wo t change because we need a repeat forever block!
It should look like this:
Now if you play, it should change when you tap it.
Now that you know how to use the increase block, you can make many can even make an increase block increase by a negative number, so you can have games where you can have increasing/decreasing scores! Hope this tutorial helped you!
Other uses of a variable block
There are many uses of a variable block. For example, in an art Pad colors are definitely several times where there needs to be a changing variable. For example, doing a hsb or rgb art pad requires four variables, maybe three without a variable for width. Colors and sizes will constantly change. It’s easy to insert the variable, but you will need to copy and paste a variable for text that is constantly set to the width/size of the pen.
Tapper games also require at least one variable, some will use both variable blocks to set a starting value, and set it so when tapped, the value increases.
There’s no doubt many games require a variable. And now you know how they are used, you can try too! Thanks for reading this quick how-to.
For People With Regular
If you have a better category or custom tag for this, please change it. Also please don’t lounge This!
People who could give extra tips
@Petrichor
@CreationsOfaNoob
@Eddie
@CodeHelp
@pomtl
@anon64955632
I will add more as I remember