Help with Variables


I just got back on hopscotch and I forget everything:(:neutral_face:

Does anyone have any tips for variables? How they work and how to use them?



Variables are numbers, but their values can change. That’s why they’re called variables. They’re useful for lots of stuff, like keeping track of stuff.


Variables can be used for global matters or object matters. When in object matters there will be a form inside the variable block. It will at first say ‘self’ but you can change it to the original object or any object. This makes it so much easier for clones to be activated and disabled during variable procedures.

Variables can be used to calculate things, like a distance calculation between two objects. Once the formula is done you can add it in a move forward or any block.

Variables also (checking my latest game would be very helpful) are used to display several scenes of a game, and can represent such parts. It helps deal with confusion.

Variables come in handy when calculating scores, times and also things like measuring FPS.


There are some good lessons here:


You may find this helpful. It’s kinda long, but the example should help

link to similar answer in another topic