No Mouse Buffer At All

Hey guys, I’m developing my second game and I thought using GDevelop would be a good idea. Well… let me describe what I’m trying to accomplish:

-You get a text and you get a button to click and go to the next text.
-This will happen so the story of the game can progress

  • Sometimes you have to take a decission and based on that the game can progress.

Problem is: when you click on one button, it takes you right to the last text, as if all the clicks were registered together, sorry I can’t describe this better… I’ll attach an image

Try using the Trigger once condition in your mouse event, so the event is going to be triggered only a single time while the mouse button is pressed.

Yes I tried that and it just doesn’t work, it’s like it breaks the code. Any other ideas?

How so? What is happening or not happening exactly?

Instead of creating and deleting buttons and texts, have you considered or tried to change text and button animation instead?

The problem is that the “mouse button released” condition is true for the entire frame (all the event sheet). GD will read the events in the specified order:

  1. Event 4: If you press the “button 1”, you delete it and create a “button 2” at the same position.
  2. Event 7: Just after that, the condition “mouse button released” is still true, and the mouse is now over “button 2”, so it is deleted and a “button 3” is created at the same position.

So finally you delete the first button, create the second and delete it in one frame, to fix it you can:

  1. Move the events 5, 6 and 7 over event 2 (events related to “button 2” over events related to “button 1”). This way, when you click the “button 1”, GD will read events related to “button 2” firstly, nothing will happen because there are no “button2” on the scene, and then will read events related to “button 1”, delete it and create a “button 2”. The next time you make a click “button 2” will be deleted as you would expect.
  2. Add an “else” variable:
    buttons.png

The last option is elegant and you can keep the natural order of events. The first button event doesn’t need the condition “else = 1”, but you can put it if you want and it will work, the last button event doesn’t need the action “else = 0”, but you can put it if you want and it will work :slight_smile:

Hey Lizard-13 that’s a very nice answer, but in your solution you are not destroying and creating the text object. What about it?

I tried your logic and it doesn’t work at all

Would you mind to change the language to english and make that screenshot again?
I didn’t and I won’t take the time to figure out what language would that be and what events you actually been using, but now you made me curious…

The problem in your logic comes from the buttons creation/deletion, you have to “port” the logic into your project :wink:

Check this:
ButtonsElse.zip (4.24 KB)

It’s spanish :slight_smile:

1 Like

Great :unamused: What I really ment the guy seem too lazy to even try what you suggesting and don’t even bothered to change the language after all this is the english community.