Discuss Scratch

_Bathroom_
Scratcher
100+ posts

What is the point of 'for this sprite only' variable

read title
medians
Scratcher
1000+ posts

What is the point of 'for this sprite only' variable

Clones, not cluttering the Data category of every sprite, when you only need it in a few sprites/one sprite, and:

Scratch Wiki wrote:

Local variables are extremely useful when a template sprite that needs to be duplicated and edited is wanted. For example, in a game where one must pop bubbles, a “bubble” sprite should be made which has personal variables like “speed” and should be programmed independently. Then it should be duplicated until there are enough bubbles. Since each bubble has an individual “speed” variable, they will not interfere with each other unlike if “speed” was a global variable.
Basically when you want it to be different in every sprite. They can still be accessed through this block:
([var v] of [sprite v])

Last edited by medians (April 30, 2023 22:21:44)

nerdyguy40
Scratcher
100+ posts

What is the point of 'for this sprite only' variable

_Bathroom_ wrote:

What is the point of ‘for this sprite only’ variable

This kind of variable can be useful, as it can have a separate value per a clone of a sprite as well.
Knightbot63
Scratcher
1000+ posts

What is the point of 'for this sprite only' variable

If you have a situation where you need variables to set an x and y of a sprite, you need to use for this sprite only or else everything will technically be there too. That's why it exists.
ARandomNumberIs7482
Scratcher
1000+ posts

What is the point of 'for this sprite only' variable

^ what he said
_Bathroom_
Scratcher
100+ posts

What is the point of 'for this sprite only' variable

Thanks for all of your answers!

Powered by DjangoBB