problem with global variables

0 favourites
  • 3 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.
  • I already post it, but not receive any response, so i open new thread.

    problem with global variables

    to see it press first green button

    after screen returns back you will see there is no levels buttons,

    If i set levels buttons global to "NO" (in properties) they not disappearing. BUT they has to to be set "YES" to be functional.

    Please help me make level buttons not disappearing

    dropbox.com/s/tifimk1a18ppe8e/menu_var.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Save the state info into an array on first launch and read the states from the array when you load the level. You can easily update the states in the array when you complete a level.

    example:

    start with an array of size 0,1,1

    on start of layout

    -if array.height = 0:

    -- for each levels_button ordered by levels_button.level descending:

    --- if array.height < levels_button.level: set size to levels_button.level,1,1

    --- : set at levels_button.level-1: levels_button.state

    • for each levels_button ordered by levels_button.level ascending:

    -- : levels_button set state to array.at(levels_button.level-1)

    set levels_button animation frame to levels_button.state

    going to a level:

    • save global var currentlvl = levels_button.level; go to level

    end of level:

    • set array.at(currentlvl-1) = 2; set array.at(currentlvl) = 1

    go to level selection

    and don't forget to set animation speed of your level buttons to 0

  • Thanks. I made it at last!

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