0 Favourites

How do I - wait until all global variables then start layout

  • Hi mates, in the making of my RPG game i realize that when i test it on iPhone the layout of my game starts then a few seconds later loads all my global variables, im looking for a way to wait until all my globals are set then start the Level layout

    The case is something like this:

    Global HeroHP int 100

    Global HeroHPKey Text HeroHPKey is for LocalStorage

    So initialize LocalStorage, and assign to HeroHPKey the value HeroHp = 100 with this value set i'm making a HealthBar like HealthBar set With = HeroHp

    Now the issue when the Level starts on iPhone it took some seconds until the HealthBar goes from With 0 to 100 and i don't know how to fix this

    On my Level Layout

    I have "On Start Layout"

    Set HealthBar With = HeroHealthBar

    And "Everytick"

    Set HealthBar With = HeroHealthBar

    Thanks in advance

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Hi UlisesFreitas - I've noticed before that iOS devices can sometimes take a few seconds to load in Local Storage data. The way I dealt with this was to load in the data in the previous layout before moving to the new one, or covering the layout with a loading image that is only removed once the data is loaded.

    One thing to be careful of is loading Local Storage data in a loader layout. As I understand it (and if I wrong I hope someone sets me straight ) if a loader layout has run once it may not run again as the game has already downloaded, so the Local Storage "get" may not be called.

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