0 Favourites

scope of local vars?

  • 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.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
163 20,226
iBarin's avatar
iBarin
Unread hot topic
102 6,400
Ashley's avatar
Ashley Construct Team Founder
Unread hot topic
51 10,465
irina's avatar
irina