[Suggestion] Global as a behavior

Discussion and feedback on Construct 2

Post » Sun Jul 15, 2012 3:32 pm

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.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Sun Jul 15, 2012 4:28 pm

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...
B
47
S
10
G
6
Posts: 455
Reputation: 8,326

Post » Sun Jul 15, 2012 5:58 pm

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.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Sun Jul 15, 2012 6:09 pm

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.
B
47
S
10
G
6
Posts: 455
Reputation: 8,326


Return to Construct 2 General

Who is online

Users browsing this forum: anty21ro, mystazsea, nimos100 and 11 guests