Scene switching not fast enough?

Hello all.

I see a behavior in GDevelop that I am unable to explain. I need to switch to a scene based on a flag variable. What I see happening is that the flag triggers the event to switch the scene but then the programs moves further down and switches to another scene.

This is what my events look like:

I’m setting the flag GameCompleted to ‘true’ and expecting the game to switch to scene “GameCompleted” but instead switches to scene “Main”. I can verify this through the console logs:
image

I also have another console log event at the beginning of the “GameCompleted” scene, so I know that the scene is not redirecting to “Main” scene. A workaround for this would be to check for the flag variable to be false on the second event, but that doesn’t seem right. Any ideas what might be the case here?

Stelios

I don’t really agree with how Gdevelop handles scene switching. It doesn’t happen immediately. It finishes all of the events before switching. It’s just like things like animation, it uses the last value and updates certain things in between frames. I guess it makes sense. IDK.

Anyways, you’ll need to use conditions so only one scene change event gets triggered. Otherwise, the last destination will be used.

1 Like

OK, I see what you mean but it was really frustrating trying to understand what was going on in the first place.

I will use more conditions to control the scene switching better. Thanks for your help Keith_1357!

Stelios

1 Like