Use multiple global variables with the same name

Get help using Construct 2

Post » Fri Jan 31, 2014 6:44 am

@Buephaze

I think topicstarter would rather not use events to set the variable.
I guess he wants to see the global variable on the eventsheet, so he can insert/change the value there.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Feb 02, 2014 2:25 pm

Hi all,

Let me be clear on this one. I use my global variables as a kind of gamesettings when a game start. For example the time to spawn a object.

This is different in every level with the same layout.

One layout which can be seen as the game frame. In that layout i check which level is selected, and than i insert the information needed for that level. So again for example the spawn speed.

This isn't hard to reach, what i was aiming for was the best way to do this.

I learn everyday with CS2 and if i check the difference between my start period and now i already know alot more to save events etc.

So sometimes i'm just not sure what the best way is to do something.

Though all methodes above are pretty small and would work great.

Thanks all!
B
10
S
4
G
3
Posts: 165
Reputation: 2,511

Post » Sun Feb 02, 2014 2:27 pm

Why not use an array and have an On Start of Layout event set a global index? Then you could use something like array[index] to access the variable.
B
9
S
3
Posts: 37
Reputation: 749

Post » Sun Feb 02, 2014 2:35 pm

Not sure what you want to do, but it sounds to me like you want to use a 1D or 2D array. Maybe it is for level properties like gravity and stuff?

Then you could set up a gravity array, and to access it you just use gravity.at(currentlevelnumber) where currentlevelnumber is the level's index you are currently in.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Previous

Return to How do I....?

Who is online

Users browsing this forum: jorgmaquoi, senecaa and 26 guests