Alternative to using a "Variable Holder" sprite?

Get help using Construct 2

Post » Mon May 21, 2012 11:55 am

@jbadams
There's one, if the object isn't global, the variables are reset on start of layout. There is a "reset all global variables" but that's an all or nothing function. I like to keep some data (like score or current level) but reset some other (like enemy counter or some) and even have some different initial values for the same variable in different layouts (like base strength of ennemies or stuff like that)

Also the object is accessible from other event sheets yes, and that's fine, but it's not accessible in a layout where you didn't put the object. Which make the variable holder object truely 'by layout'. So you will just have to be carefull with included event sheet that uses these variables not to include them in event sheets of layout that doesn't have the object.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Mon May 21, 2012 1:16 pm

I'd go with a Dictionary object. Then you have two options: use the instance variables C2 gives to every object, or use the string-based Dictionary storage (which might be useful for dynamic things).
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Previous

Return to How do I....?

Who is online

Users browsing this forum: linkman2004, supreme676 and 20 guests