I want the controller to disappear as soon as the player removes his fingers from the touchscreen . And reappear again when the user touches the screen.
The Controller should act in the given manner ---
*When the Screen is touched the controller should appear --

*When the player drags his fingers to the centre of the controlle should move too..

The following code is meant for the GUI and not for actual player monement..which as usual doesn't work ...CODE -
func _process(delta):
Controls.hide() #Controller pad hide
if(Input.is_mouse_button_pressed(BUTTON_LEFT)) :
curPos = get_viewport().get_mouse_position() #cursor position when clicked
Controls.show() and Controls.show_on_top #Controller pad show
Controls.position = curPos
new_curPos = get_viewport().get_mouse_position() #new cursor position when mouse moved
rel_curPos = new_curPos - curPos #relative cursor position
if (rel_curPos != Vector2(0,0)) :
Dpad_Center.position = rel_curPos.normalized() + 100

What the code is doing is - it just makes the controller appear and following the mouse ..
What I want it to do is -- When Mouse clicked the controller pad should appear..and when I drag the mouse the Centre of the controller should move while keeping the controller boundary kept fixed..