Yeah I know, newt wants everything as a behavior, but this one actually makes sense.
Yes it would probably brake a few games, but when you think about it, no one uses global for an object because it breaks every thing anyway.
Then if someone does use it, its usually because they don't understand how it works.
The way I see it, if you were to make it a behavior, it would obfuscate it a bit, and people would be less apt to add it.
Then what would really be nice is if you could add the ability to change the behavior at runtime, which, in theory, could solve all the issues with it breaking things.
Like layout 1 set sprite.global to disabled, or layout 2 set sprite.global to enabled, so it would show up on the next layout.
Develop games in your browser. Powerful, performant & highly capable.
Global breaks things? ?_?
Isn't global necessary for "player" characters and stuff like that? I was thinking of using it, but now I am skeptical...
Global for an object simply means save it's state from one layout to the next. That includes it's x, and y, and any variables it uses.
That's great say if you have a platform and you want to player to resume its position in the next layout, but, and its a big but, if you have a layout where you don't want that sprite to be in you have to add events to deal with that. So basically you would have to save it's state into a global variable beforehand, which practically negates the usefulness of the global preference.
Now I understand why you say it would be better as a behavior. To have control over things like that. I think it's a good idea.