[SOLVED]How to pause the game when the mouse is idle

Hello everyone, I’m a beginner in game development.

I’m currently working on a clickable puzzle game. I would like to ask for your advice on how to pause the game when the mouse is idle for a certain number of seconds in Gdevelop 5. I have created the pause scene, and I would like to know how to set up the mouse part.

This project is part of my master’s research, and I would appreciate any assistance. Thank you all in advance.

Have a nice day!

Hi, there is an extension that is checking the mouse or cursor movement:
Capture_mouse

Hi, that works nicely!
Thank you so much for your advice :pleading_face:

1 Like

Hi Drona,

Thank you for the method you provided earlier. The event does indeed occur after a few seconds of mouse inactivity. However, it is also triggered immediately when the scene starts.

For example, I want the “idle” object to appear only after 15 seconds of mouse inactivity, but it appears right at the beginning of the scene. Could you please let me know if there is an error in my settings?

Thank you very much.

I have checked that and it seems that something is not okay with the way the extension works. I fiddled a bit around and it seems I found a solution. Since this is an extension I cannot tell you if my change is breaking something etc. but you can give it a try:

When you select the condition “Cursor has stayed still” in your events a window occurs in which you can set the seconds, there is also a button that says Capture_button

If you click it, you get into the extension-editor. When you click now in the upper left Functions-window on the “CursorStayStill” function an event sheet as you know it comes up. I don’t fully understand what is going on there but I added an event like in the red box:

It is basically the initialization of the timer which I could not find anywhere else. As far as I see, it seems to work now, but again there could be strange side effects.

Hi, that works nicely! No side effects so far.

Thank you very much for your help :laughing:

1 Like