Global Variable Taking a While to Change

Discussion and feedback on Construct 2

Post » Wed Oct 30, 2013 9:49 am

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)
B
5
Posts: 14
Reputation: 403

Post » Wed Oct 30, 2013 1:07 pm

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".
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788


Return to Construct 2 General

Who is online

Users browsing this forum: JesusJ and 15 guests