touch and drag

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DexterFstone

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?