Currently, variables and lists 'for all sprites' need to be defined in the stage while also being under a hat block like this:
costumes "blank.svg";
onflag {
x = 0;
delete list;
}
Unfortunately, this means that both of them are automatically reset when a project is restarted. It also interferes with scripts in other sprites that make use of these variables and lists right after the green flag is clicked, resetting them after a value has already been set or an item has already been added.
I've been able to resolve this issue with a simple workaround, but this doesn't appear to be intended behavior:
Maybe this could be solved by adding new syntax? Or, alternatively, changes could be made to allow blocks to exist without a hat block, however that does not sound like a great idea to me.
Using the workaround I found is not a huge inconvenience, but it did take me some time to figure out why my project wasn't working...
Currently, variables and lists 'for all sprites' need to be defined in the stage while also being under a hat block like this:
Unfortunately, this means that both of them are automatically reset when a project is restarted. It also interferes with scripts in other sprites that make use of these variables and lists right after the green flag is clicked, resetting them after a value has already been set or an item has already been added.
I've been able to resolve this issue with a simple workaround, but this doesn't appear to be intended behavior:
Maybe this could be solved by adding new syntax? Or, alternatively, changes could be made to allow blocks to exist without a hat block, however that does not sound like a great idea to me. Using the workaround I found is not a huge inconvenience, but it did take me some time to figure out why my project wasn't working...