MouseButton OnRelease

Hi :slight_smile:

I was just wondering if there was a way to create a condition onMouseButtonRelease, and not onMouseButtonDown, because when transitioning from one scene to another, some objects get triggered automatically if the mouse button is still down.
To clarify:

I have a scene for a lost game with a Return to Main Menu Button. If this is pressed, I return, but the position of the button coincides with the level1 button, so it gets triggered automatically.

Thanks in advance :slight_smile:

U can use timer so it waits few seconds befor u can click again.

I asked several times about this feature, for me it’s a big lack of GD. Every solution i tried are totally unsufficient. So +1 for the feature.

Let me know if you have something really working.

I have lot of problems about this because the condition “mouse on object” and “the left button is pressed” always work on multiple objects on different plan, and even with a variable on mouse “status” it becames a mess on conditions for simple button… The best way to me should be to replace all “pressed” event by “released”, like we do almost everywhere on UI.

onClick is good for touch screen, but definitively crap for mouse inputs.

Just invert the condition “Mouse button X is pressed” (with the checkbox at the bottom in the condition setup), this will return True while the mouse button is NOT pressed. Now add a “Trigger once” condition, the event will return True the first time the button is not pressed :slight_smile:

yeah but if i hover the button, AND the button is not pressed, it is the same as just hovering the mouse over the button :confused:

Oh yes, I was answering how to get a “On mouse button release” condition :slight_smile:
About your problem, this is due to the “Trigger once” condition, it doesn’t work when you switch between scenes (for the next scene, it’s the first time you press the mouse button, even if it is not), I’ve answered a similar question here:
[url]Menu problem! jump directly from moveset page to main menu? - #7 by Lizard-13]
You can put a timer as pleox suggests and as I think Umar did in the linked topic, so you have some time after the scene starts to move the cursor off the button. Easy but not complete, since you force the players to move the cursor just because.
Or you can force the player to don’t hold the mouse button at least one frame. This is the expected behavior, if you go to another scene and there is a new sprite button, you should release the mouse button and press it again over the new sprite button. This way is explained in the linked post :slight_smile:

I have the same problem when i’m changing scene and when i destroy some objects wich spawn others objects on its destructions. i’tried to put a timer before the other clickable object spawn, but this is not convincing at all, i really need to create a condition is a real trigger on mouse release.

Yeah, I have already thought of adding variables to the scenes, but that seems to be a dirty workaround. I still think that the OnRelease condition would be a very VERY good improvement in the workflow of Gdevelop. Let’s see if the feature request will find some love with the devs :wink: