scope of local vars?

Get help using Construct 2

Post » Tue Sep 18, 2012 1:42 pm

Hi, I cant find any man pages for variable scope, does anyone know if there is one?

1) What are the scope of local vars? E.g. if I create local vars at the top of a group, are they local to a group, the event sheet, or just the next event?

2) Are global vars global to all event sheets?

3) To try and simulate objects for better encapsulation and reuse, I want to create vars local to one event sheet. Is this possible, as you only seem to be able to create globals at this level?

4) I see objects have a "global" setting. This seems odd, as objects seem to be global even if set to "no". E.g. if I copy an object from one layout to another, then modify the copied one, when I create an instance of the object on the first layout, it actually uses the settings from the second layout.
Posts: 357
Reputation: 3,691

Post » Tue Sep 18, 2012 1:50 pm

1. from manual

2. Yes

3. Not really - see point 1.

4. Global object means that this object is not destroyed after going to another layout. It will still have all parameters (like instance variable). Every "not global" object is destroyed and all parameters are reset after going to another layout.
Posts: 2,547
Reputation: 30,650

Return to How do I....?

Who is online

Users browsing this forum: blackhornet, Bro7hers, Colorfish, Google [Bot], Magistross and 15 guests