Are local variables unique for each clone?

Hi!
I tested with a simple script, but I need to confirm it: if I create a local variable (LV) for a given sprite, will the LV be the same for all the clones of that sprite, or unique for each one?
I am questioning that, because I need to have variables that are unique for each sprite. First time I tried with the "script variable" block, but it seems that it can be used only within the same hat block...
Thanks!!

Yes, by default each clone gets its own sprite-local variables.

I think that answers your question, but if you want to know more, read on.

Every property of a clone (local variable, local block, position, direction, wardrobe (list of costumes), everything) can be shared with its parent or not shared as you choose. If something is shared and you want to unshare it, just change its value -- assign a new value to a variable, move the clone to a new position, etc. If the parent changes a shared property, it remains shared, so a clone can TELL its parent to change the property and it'll remain shared. If something is unshared and you want to share it, use the INHERIT block. If it's a sprite-local variable or a commonly shared property you can select it from the pulldown menu; for other properties, put a ring around its reporter and put that in the block:
inherit

But we try to read your mind and choose the most common sharing option for each property.

Thanks for the excelent clarification of my question :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.