[SOLVED] Scene doesn't change

Hey, this is the first game i’m making in Gdevelop.
And i have a problem, and dont know how to fix it. I want to change the scene to another one, after the conditions are met. But it doesn’t work how I want.
Because the code in this first example works. But in the second it only plays the animation but won’t change to another scene.

first example
Code


Video example
https://youtu.be/J-CpJQTyEIE


Next scene
But the same code doesn’t work in this scene. And doesn’t change to the next scene after the animation.
Code : https://imgur.com/a/wZpNKJe

Video example :
https://youtu.be/ACAE40j6fe4

What am i doing wrong?

Edited post because i can’t post more then 2 links. No embedded YouTube videos. And i could only upload 1 image. Why?

Video example of second code :
https://youtu.be/ACAE40j6fe4

Because this is your 1st post.
In second code you have to add aanwijzer is in collision with bar. (invert condition)

To go to random scene, create a RandomInRange(1,3) to Global Variable any_name

and change to “scene” + GlobalVariableString(any_name)

Thanks for your answer.

But the aanwijzer and bar is for the first code. Which works fine.
The problem is with the second code.

And where do i fill in randominrange etc? I can’t find how to do that in the events page.

Thanks for your time!

Regarding to randominrange, at the screen where you assign a value to the variable you are creating, click on the blue button at the right side of value line. Search for random and then random integer in range. It will ask you for the min. value=1 and max. value=3.

I’m sorry, I messed up things here about the code. Thre’s no way aanwijzer collides with the bar without collides with the stopper as well. So you need to add an “And”. You find it under Advanced. Use the code you already have and the code I told you (without inversion).
Maybe I’m wrong. I cannot see the object bar watching your video. What bar is it? Is it invisible?
Or the bar is the moving bar? Object aanwijzer doesn’t show up on your video?

The first code is working fine. The game is working how i want. And the animation and scene change is how i wanted it to be. The inversion is because i dont want the aanwijzer to be on the stopper and bar at the same time if it stops, labeld as good. Therefore it will be labeld as fout(bad). So this code is working fine for me.

The second code where there is no aanwijzer or bar. That’s where the problem is. Because i get the animations after the condition but not the change to a new scene. Here is the whole code, maybe that will help.

And where do i find the right variable page. Because the 2 ways i know how to go to the variables. Is in the game settings menu (global variables) and the object variables if you click on
a object on the left side. And if you right click on object and click on edit variables. In both occasions it doesnt show a blue button. Only a grey +, which allows me to add a variable. But i cannot search for random. Because the only thing i see is a grey +.

Thanks for the info for the random scenes, I highly appreciate that.

But can somebody help me with this problem? Is it because some objects still move, when I want to change to a new scene? Is there a code that I can stop all objects globaly, if I want to change to another scene? Or is it something else?

(I tried to put stop object, and opacity -30 next to the collision condition, then the scene will change. But I have more scenes with the same problem. But that won’t work in other scenes)

Because the code works in first example. But other scenes, with the same code. Will show the animations but not the change to another scene.

still need help. what do I need to change?

still need help. what do I need to change?
Got help for random scenes. But the main question of this topic, is unanswered. I restructured the main post.

If your animation change and scene don’t change at this step, your problem is between.

You have a condition on an object for verify is the animation is finished. Then if scene dosen’t change, the condition is not true.
Or you have made a typo in name of scenes?

No there is no typo. Everything is exactly the same in the second code.

That’s what I find strange. It should work. I don’t know what im doing wrong.

Because the condition is “animation finished”, and it plays the animation. How does it register not true?

Wait so you say the animation is still playing and you wonder why animation finished registers as false? How do you want it to be finished if it is still doing it?

No… where do I say that. Maybe look to the examples before you react to something.

English isn’t my native language, but I thought I described everything clearly enough.

Put another action instead of “change scene”
Put an action that displays and works at 100%.

For example, put a new text object in the foreground.
And instead of changing the scene, you hide the text object.

If text doesn’t hide the condition is wrong. (like i think)
If text is hiding it may be that there is a problem in the scene that must be after.


I always debug my events this way.
With something that certainly works and in this way I isolate the problem.
It gives leads to where not to look and where to look.

Allright, I will try that Thursday-evening when I’m home from work.

But can the problem also be in another chunck of code? Instead of “goal” and “verloren”? Or do I specifically have to look there?

I don’t think it’s a problem with the next scene. Because that’s only a red background (or green) with text.

Thanks for the info!

I’ve tried to hide text. And it wont hide, nothing is happening after the animation is finished.
But how is the condition wrong? What can i change about that?

I tried invert condition on the animation finished, and then the change to the new scene works.
But then the animation doesn’t play (which is how it should work?).

(Also changed the collision with mouse scroll, but the same is happening with this condition. No scene after the animation is finished.)

SOLVED :

For people that will encounter the same problem.
I mader the animation set to a name instead of +1 in animation. (this was not the problem, but is better to not get repeated)
I changed the animation finished & change scene from a sub-event to an main-event

1 Like