–1 vote

Hi I have this code

func _on_ColorRect_gui_input(event):
if event is InputEventScreenTouch and input == 0:
    press = int(get_global_mouse_position().x)
if event is InputEventScreenDrag and input == 0:
    release = int(get_global_mouse_position().x)
    if press < release:
        $"UI/Answer Board/Tween".interpolate_property($"UI/Answer Board/ColorRect","rect_position:x",$"UI/Answer Board/ColorRect".rect_position.x,$"UI/Answer Board/ColorRect".rect_position.x+150,0.2,1,Tween.EASE_IN,0)
        $"UI/Answer Board/Tween".start()
        input = 1
    elif press > release:
        $"UI/Answer Board/Tween".interpolate_property($"UI/Answer Board/ColorRect","rect_position:x",$"UI/Answer Board/ColorRect".rect_position.x,$"UI/Answer Board/ColorRect".rect_position.x-150,0.2,1,Tween.EASE_IN,0)
        $"UI/Answer Board/Tween".start()
        input = -1
pass # Replace with function body.

Now my question is how to turn off touch and drag? it codes always work but I want to work just 1 time, I need something like release event with code

any idea? code? tips?

Godot version 3.4
in Engine by (43 points)

Please log in or register to answer this question.

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.