Layout variables

New releases and general discussions.

Post » Fri Mar 19, 2010 11:58 am

There are global and private variables as well as array/hash/python options. However, I believe it would make sense to have Layout-specific variables as well. Too often I find myself using variables that pertain to the current layout only.

These variables could be set to "persist" - remember the value after layout is closed - or "forget" - reset to the default value after the layout is closed.

These variables would be accessible through Layout properties as well as system expressions. Perhaps local('variable') just like global('variable')?

Should the need to retrieve other layouts' variables arise, I suppose that could be done by adding another expression: get layout variable(layout, variable) or something.

I reckon this would be of great help. I feel such a layout-specific variable is the missing link between global and object variables.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Fri Mar 19, 2010 2:05 pm

just use private variables with a controller object you"ll get the same effect
B
14
S
2
G
2
Posts: 41
Reputation: 1,396

Post » Fri Mar 19, 2010 3:54 pm

Private variables on a sprite is a good workaround but not perfect, since you have an entire sprite on an object that has a position, angle etc. I've collected a few nice ideas for better handling of variables for Construct 2, but I doubt things will change from as they are now.
Scirra Founder
B
358
S
214
G
72
Posts: 22,946
Reputation: 178,333

Post » Fri Mar 19, 2010 3:54 pm

This was requested before, and the devs have said "possibly, but not until C2."

viewtopic.php?f=17&t=3414

In fact, you were in that thread arguing against Layout Variables, Mipey... so, uh... yeah. I guess you had a change of heart? :P
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Fri Mar 19, 2010 3:59 pm

:oops:

Kind of. Sprites add to the overhead, it does show when you are working on a major project.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Fri Mar 19, 2010 4:02 pm

Hehe, it's cool :P. Anyway, Aeal's link to his VBank plugin on page two of that thread still works, so you might want to grab it. It just stores variables without having any sprite information.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 1 guest