Hi,
I'm working on a project where I want the program to list a bunch of 4-digit numbers, which each digit is a separate calculation. I set up a variable called x to store the x-position of the number, but then I realized that when I changed x for the 2nd sprite, I was changing it for the first sprite. I noticed that when I make a variable, I can make it for only one sprite. Is it possible for me to set up an "x" for each of my 4 sprites and have them not overlap or confuse myself? Or should I set up an x1, an x2, etc.? Opinions from veteran scratchers?
Offline
Check "For this sprite only" when making the variable
Offline
Hyperbola wrote:
Check "For this sprite only" when making the variable
+1. ^_^
Offline
echristophy wrote:
Hi,
I'm working on a project where I want the program to list a bunch of 4-digit numbers, which each digit is a separate calculation. I set up a variable called x to store the x-position of the number, but then I realized that when I changed x for the 2nd sprite, I was changing it for the first sprite. I noticed that when I make a variable, I can make it for only one sprite. Is it possible for me to set up an "x" for each of my 4 sprites and have them not overlap or confuse myself? Or should I set up an x1, an x2, etc.? Opinions from veteran scratchers?
Well, there are two different types of variables in Scratch, "Global" and "Local".
If you want a certain variable to only be for one sprite, then check the "For this sprite only" check box when creating it. Even though it's now only for the sprite you created it for, other sprites can access the info, but cannot change it using the,
< [attacked? v] of [Sprite 1 v] >Block. The "attacked?" is an applicable scenario.
Offline