Request: "input reset when scene changes" option

Let me explain…

So when you use the “key pressed” and “trigger once” condition. It works, but not when you switch to the next scene.

suppose you’re making a pause screen screen. You press Q to pause it, and you could press q again to unpause, problem is, when it changes scene, it immediately detects it again and suddenly unpauses it.

yes, you could use the “key released” condition instead. but it gives it a sense of input delay.

one way to fix this is adding an option to scene properties where all input would reset when the scene starts up, even when a key is still held down. you could also have this be an action as well.

Just to add some clarity to this, while I’m all for the idea here, what you are describing as an issue is a pretty common thing across all game design.

Normally you build out a global toggle variable for your confirm key/button press/mouse click/ etc, and add a requirement that the variable is false to activate anything. You set it to true when activating anything. Then only set it to false if said key/button/mouse click is no longer pressed. (NOT the released condition, inverted pressed conditions)

Events to handle held/release detection would be added to each scene (in GDevelop I usually just make an external event sheet with the not-pressed detection and add it to my scenes)

Again, I’m all for a way to simplify this, but just wanted to be clear about this process/behaviour seen as an issue is actually something pretty standard.

1 Like

could you show me an example? all this sounds really confusing… :neutral_face:

I’ll try to make a small example later today.

This is basically all you need:

The “e key is pressed (inverted)” event is what I’d normally keep in an external event sheet and include it in every scene. The boolean condition is what you’d add to any event that uses the E key.

Here’s this in use in an example: https://game-previews.gdevelop-app.com/1646162498012-336301/index.html

Here’s the full event sheet for scene 1:

Scene 2 is identical, except it changes back to scene 1. With this set up, even though the exact same events/objects/etc are being used in both scenes, holding E doesn’t flip back and forth. The player must release the E key before pressing it again. The same would be true if you set it up for mouse clicks, or gamepad buttons, etc.

okay, so I’m making a pause event, where you press q and it’ll pause and show the “pause layer”.

The main reason why I posted this request, is because I kept on running into the issue I described.

I tried doing what you did, but it’s not working.

How do i fix this?

I don’t think you can nest the events like that because it’ll still flip between layer is visible/layer is hidden due to event order, even with the trigger once.

This works fine for me:

Edit: here’s a quick edit of the platformer example with it working https://game-previews.gdevelop-app.com/1646168140911-292234/index.html

1 Like

Thank you so much! You helped me fix it!