Adding layout variable scope

Discussion and feedback on Construct 2

Post » Wed Nov 30, 2011 3:18 pm

Right now we have global and local variables and it works really well. I might suggest adding layout variables. The reason for this is that a lot of time I use triggers and other level specific game objects.

Having a layout variable would make things look and feel a lot better. I could see what variables are in that layout. If I use the trigger example I currently have to label them like this

TriggerL1T1
TriggerL2T2
ect.

But with the local variable I could just say
TriggerT1
ect

On top of that, if they were a different color at the top it would make things visually easier.

Just a thought. Keep being awesome Scirra.
B
69
S
11
G
6
Posts: 324
Reputation: 8,321

Post » Mon Mar 11, 2013 3:24 pm

Hmm, this is old, but I still do not see the feature around. I'd like to support this suggestion.

Currently, I'm using some sprites as buttons, and I'd like for them to come up variables as to which is clicked so I can properly control my fading in and out. Just to make sure they do not overlap with other variables from other Layouts.

Hope you guys can also support this in the future, I'm having a great experience so far. Thank you! :)
B
6
S
1
Posts: 10
Reputation: 774

Post » Mon Mar 11, 2013 4:08 pm

In the event-sheet editor, right click and choose "Add Local Variable" :P
B
45
S
19
G
10
Posts: 562
Reputation: 9,543

Post » Mon Mar 11, 2013 5:34 pm

Event sheets are not matched one-to-one with layouts - you can include one event sheet in multiple other event sheets, for example. So there's no obvious way in the event system to make a global variable but unique to a particular layout. I think the best way is just to use globals, or static local variables in groups, or similar.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Mon Mar 11, 2013 5:53 pm

I was actually going to suggest this but using a dedicated object for layout variables works just as well o.o
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024


Return to Construct 2 General

Who is online

Users browsing this forum: Lof and 1 guest