This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hi there i am just wondering if it possible to forcefully make a pressed mouse to be unpressed via script, i really need it for the swipe logic of my game wherein i need to forcefully unpress the touch event after a period of time

thanks in advance

in Engine by (410 points)

2 Answers

+1 vote
Best answer

You can use Input.parse_input_event() for this.
For the left mouse button it would look like this:

func release_left_mouse_button():
    var a =
by (1,476 points)
selected by

Sorry for super late reply hahaha, thanks for your help, it really helped me a lot

+1 vote

Just run the swipe logic after the given time and ignore user input. It's almost like asking to un-press a keyboard press. Unless your mouse has the ability to shock the user to releasing it. That'll teach em.

by (810 points)

thank you so much

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.