Global Variable Taking a While to Change

  • Hi, hope you can help,

    At the end of a score summary sequence I have made I want to spawn a continue button to advance to the next step. Throughout the score sequence I increment a global variable called UIProgress in order to cue the next step of the sequence. This works fine I think, however, when I get to the end and look at it in the debugger I am getting multiple buttons created by my last event and the global variable takes some time to update.

    The final event goes:

    UIProgress = 9 -> Set UIProgress = 10

                      Call function "SpawnButton" (Bunch of params for the button)

    I guess the reason I am getting multiple buttons is because it is going through this event a few times before the variable is getting set to 10 but I don't get why. I don't always get the same amount of buttons created either and am a bit baffled. Anyone have any ideas? I have tried adding a small wait timer and it improves it but doesn't fix it.(between 1 and 4 buttons created rather than 7-20 ish)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm that's weird. You could add trigger once while true to the conditions to only make it spawn one button, but I guess that doesn't answer the question where this delay comes from. Any possible way the variable gets set to 9 again?

    You could also just use a timer (behavior) and create the button "on timer".

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