There is a convienent secret to Local Variables to make only a couple of sprites read them!
There is a circle block that looks like this, but an actual BLOCK ( )
([v X position] of [v Sprite])
It can read local variables!
I.E. =
Sprite1 has a 'local' variable called (Score)
With the ([x position] of [Sprite]) block,
Sprite2 can read the score by setting the [x position] to ([Score] of [Sprite1])!
That is a cool trick for sharing variables for only certain sprites!
Keep Scratching, Scratchers!
Last edited by bbbeb (2010-08-22 21:21:18)
Offline
This block has helped me out numerous times.
-12three-
Offline
Whoa, I never knew you could do that. COOL!
Offline
I actually just discovered that a couple weeks ago!
Offline
MoreGamesNow wrote:
I actually just discovered that a couple weeks ago!
Same with me!
Offline
I knew this for ages. There is a error however.
make a variable for sprite1 called 'direction'.
Set it to hacked.
Then use the (|direction| of |Sprite1|). Use the one refering to the direction of Sprite1 e.g 90.
It will report your local variable, eg 'hacked'!
Offline
johnnydean1 wrote:
I knew this for ages. There is a error however.
make a variable for sprite1 called 'direction'.
Set it to hacked.
Then use the (|direction| of |Sprite1|). Use the one refering to the direction of Sprite1 e.g 90.
It will report your local variable, eg 'hacked'!
It doesn't do that for me...
Offline
Awesome! I never knew that!!
ScratchReallyROCKS wrote:
johnnydean1 wrote:
I knew this for ages. There is a error however.
make a variable for sprite1 called 'direction'.
Set it to hacked.
Then use the (|direction| of |Sprite1|). Use the one refering to the direction of Sprite1 e.g 90.
It will report your local variable, eg 'hacked'!It doesn't do that for me...
It works; I've done it for confusing x & y positions in a certain project.
Offline
bbbeb wrote:
@johnnydean1: why do we want to know about errors again?
'Cuz they're fun.
And thanks for posting this! I never knew that. It'll save me if I accidentally do a bunch of programming with a local variable that was supposed to be global.
Offline