Event Sheet Includes - do they include variables?

0 favourites
  • 4 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hi!

    Just a quick question - When you Include an Event Sheet into another, does it also include all the Global Variables declared in the previous one all over again?

    For example you have declared a globalVariable1 = 0 in Sheet 1. Let's say during the course of gameplay globalVariable1 becomes = 5.

    If you include Sheet 1 in Sheet2, when the game switches to Sheet2, will globalVariable1 be set to 0 again or will it remain at 5?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Global variables are global to the whole project.

    It means that you can access the variables declared even in a non-included event sheet.

    So no, the global variables are not included "again".

  • If they are global to the whole project why are they only visible in the Event Sheet they were declared in?

    Also, if you have EventSheet1 for Layout1 and EventSheet2 for Layout2.

    If you declare a global variable in EventSheet2(which doesn't come into "play" before 5 mins have passed for example), will the global variables from EventSheet2 be availible for use by EventSheet1 at the very start, even tho EventSheet2 has never been "called" yet?

  • The declaration is only "visible" in the event sheet they are "created" into but yes they can be accessed through the whole project.

    Simply do the test and you'll see the variable is nevertheless accessible (which means it can be modified and is visible in the dropbox of the action "Add to" for example).

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)