Hello. I have a topic here: Start/Pause Menu Help. I think this may be a bug in the trigger once condition when changing scenes? After I press the return key (once) to change a scene, gdevelop changes the scene, but then thinks i’m still pressing the return key on the new scene and loops me back to the original scene, since I have a command to change scenes on that scene too with the return key. It should only trigger once, but continues pressing return, creating a loop.
That’s not a bug. The scene change happens in one frame, and you’re still holding return after the scene changes, since you’re not superhuman and cannot hold it for less than 1 frame.
You’ll need to implement a toggle state global variable that ensures it only counts the action as happening once.
You can read more about the concept here: How to toggle states using Variables [GDevelop wiki]
But basically, you want a global variable that gets set to 1 (or true) when you press return as part of the switching scenes event, and gets set back to 0 (or false) when you release return.
Then you add a condition that requires the variable to be 0/false as part of your change scene variable.
Thanks for clearing that up. I will have to check into making a toggle state. I hope I can figure it out.
First: please stop making multiple threads for the same issue. The 3rd thread you attempted to make has been deleted.
In your case, your toggle state is amongst multiple scenes. So you need to ensure your requirement is on all scenes. So you’ll need to ensure you have the same toggle state variable requirements on the other scene as well.
This means on all scenes where you’re using return to change scne, you need to have a requirement for the boolean value of the global variable = false. And you need to ensure you’re setting it to true when you press return.
I also wouldn’t use the “toggle the state of boolean variable” action since you’re not going to be toggling the state in the same scene/action. I’d use “set the boolean value” and set it to falsee (or true) depending on the action. You’d use “true” for the actual event where you’re pressing return, and “false” for the event where you’re releasing return.
Silver-Streak, I don’t appreciate this. Nobody needs to be talked down to, especially people first getting into coding. Believe it or not, GDevelop attracts a lot of first time developers, because of its ease of use and simple to use software (except many of us are still struggling). I imagine i’m not the only one posting a lot of questions that may seem redundant and foolish to people that know better. First of all, the multiple threads I made were of different aspects of the same issue, each focusing on their respective problem. I see nothing wrong with making a new thread focusing on a different issue of the same problem, especially if nobody is commenting on the other threads. There are not a great deal of tutorials yet on these particular issues. Second, there are many people like you that are very educated and can help people like me, and ought to see it as an opportunity to grow the Gdevelop brand. Nothing you have done here is helping grow this consumer/community base. I don’t understand anything you just suggested to solve my problem, it all went over my head. Unless someone is shown where they went wrong and modeled how to fix it, unfortunately, they don’t learn. Everyone is that way. I don’t say any of this to start a conflict. I say it to help. We all need help and there are many smart people on these forums, including you, that could help the next generation of developers and grow the GDevelop community. Please be more helpful, patient, and kind, you will see it come back to you many times more.
To understand what exactly your problem is, you need to see your entire code. Therefore, I suggest that you create a new project in which the problem will be demonstrated. It is difficult to navigate through small pieces of code. Therefore, they explain to you how it should work in general, and not specifically on your project.
I appreciate you don’t like being directly called out, and am sorry that it seems to have made you uncomfortable with the situation. As this guidance is important for anyone and everyone, I’ll provide more context with the info in your post:
One of the main rules listed in the FAQ and the post when you join is " * Don’t cross-post the same thing in multiple topics."
Multiple community members reported the other threads for not adhering to this, and that is what brought it to my attention. They were correct to call it out.
- Yes, this is why the original post was given to inform you it was wrong and to avoid doing so in the future.
- Different facets of the same problem doesn’t change the actual problem, especially since its not like people only see one thread and then never see the other. New threads are fine for new problems. Your other threads were both on the same problem of your menu and trying to change scene on selection.
Not getting a reply to a thread also doesn’t change the problem, and therefore doesn’t make it okay to repost it as a new thread. That’s basically a much worse version of “bumping”, which also makes it harder for other community members to have their own questions seen and answered.
While I understand what you’re trying to convey with the rest of the post, the instruction given above remains the same, please adhere to it going forward.
Back on topic, this is the action in the action finder I was mentioning:
You should replace your existing “Toggle the boolean value” action with this one, and ensure it sets the boolean to “True”
The conditions will show up with the exact same name in the condition finder, but you’re already using that condition so you souldn’t need to change it.
You still need to add a completely separate event for the “release return key” logic. Which should just be an entirely separte event that checks “the boolean variable global variable menu is true” and “return key is released”, along with Trigger Once. The action would be to set the boolean back to false.
You will need both of these events in every scene you’re using the return key to change a scene.
All of these issues you pointed out, are a matter of opinion. In the end, I hope you really reconsider how you interact with people going forward. It can really make or break a community.
I want to be clear here:
The above statements are based on adherence to the rules. As a moderator it is my role to enforce said rules, and to reiterate them in situations where someone has either misunderstood or broken them. Regardless of your feelings about whether you agree with the rules, please adhere to them going forward.
Again, back on topic, if you run into issues with the events guidance above, post it in this thread and people will potentially be able to further help.
Moderating with compassion can go a long way my friend. Anyway, thanks for the help you did provide.
Here are 9 hours of delays to calm the spirits and refocus on the basic topic.
Do not open a new topic before the automatic reopening of this one
To resume at the start this is not a bug.
Indeed the action of the key is detected when you come on the other scene because the input is still pressed.
A state switch is a good solution to this problem.
Another one is to use the condition released key instead of pressed.
Since it is not a bug, moving this to the category #help-for-games-creation .
This topic was automatically opened after 9 hours.