Only one object will be hidden when using "Or" conditions and a "Key Pressed/Released" Condition

For some reason everything works as expected in the event except the Button_3 won’t hide. And its only on the return released action. When i use the mouse, everything works fine. When I use the return key everything works fine, except for the button_3 not hiding. And yes I checked that my scene variable is actually 1 when doing this. Plus like I said, this event triggers, and it works, just not the button_3 hiding part.

This events seems fine, do you have any other events to show the butto3 maybe that’s the problem, I’m guessing here

yeah, that was my first guess too. I did a search for all actions including “button_3” and this is only one that shows it. All other actions hide it.

Rather than the timer that is reset I don’t know the other 2 variables are set to false/true confirminganswer and usingLifeLine I ask why are those 2 needed if you can just control when to show those objects with the timer itself.
I’m going to try to reproduce this in an example check later.

I was able to prove that this is a bug (or most likely i’m misunderstanding a part of GDevelop). But i created a brand new game and only have one event. When I click the blue button with my mouse both buttons disappear. But if click the enter/return key on my keyboard, only the yellow button disappears. Am i missing something?

As a general heads up, you should always use “Trigger Once” when showing or hiding an object.

Regardless of that, I can reproduce this issue. It seems to be related to using Or and Ands + Key released/pressed conditions.

https://game-previews.gdevelop-app.com/1633026673450-970601/index.html

This has the same behavior as described above (only one button is hidden when pressing return. Same happens if “Key is pressed” is used instead of “key is released”)

This works as expected:

For @julius_sac, as a workaround you should not use Or+and conditions, and just build separate events as subevents of a parent event with a condition of “The boolean value of scene variable buttonsEnabled is true”.

Moving this to bug reports.

1 Like

Hi @Silver-Streak is there any update on this bug? It came up again in another game I’m creating. (I’m currently on 5.0.124)

I’ve not seen anything on this being changed in recent updates. I did throw this thread into the development section of the discord to see if anyone had any thoughts, if so you’ll likely see them post here.

The only thing that was mentioned that using “released” doesn’t play well with “trigger once”, but I remember testing it occurring with “pressed” as well, so I don’t think that’ll fully impact it.

If you do end up trying this again (without the workaround I mentioned in my post above), you might also try adding “Pick all GreenButton” and “Pick all Bluebutton” to the conditions or actions (they exist for both, so choose one or the other, not both conditions AND actions) as that should reforce it to apply to all of them.

Gotcha. Thank you for the update!

1 Like