Global HUD Help

0 favourites
  • 5 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Hi,

    I'm attempting to implement a global HUD into my game suggested here: scirra.com/forum/forum_posts.asp

    I'm trying to load the HUD automatically at the start of each level. It is probably easiest to explain in program form

    <font face="Courier New, Courier, mono">

    GLOBALEVENTS:

         HudLoaded = 0

         IF HudLoaded == 0

              GOTO LOADHUD              

    LEVEL 1:

        IMPORT GLOBALEVENTS

         ON LEVEL_END

              TURN HUD OFF

              

    LOADHUD:

         HudLoaded = 1

         GOTO LEVEL 1

    </font>

    Obviously, this creates a loop. How can I create a global variable that is not reset every time the event sheet it is on is loaded? One solution would be to load globals at the beginning of the game, however this won't work if I am debugging.

    How should I approach this?

  • Global variables don't reset unless you ask them to. If you 'include' the event sheet on more than one layout the global variable shouldn't change value between layouts.

  • Global's don't reset unless you use "Reset global vars"

    And if you need to reset some Global vars and not all of them then:

    At the end of layout > Set "OtherGlobalVariable eg 'Health'" to 100

  • Don�t use there global variables, use local variables they reset automatically.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks guys. Got it sorted. t turns out my "Return to original level" was setup wrong. I'm glad I know about the globals now!

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