How do you make the touch screen buttons visible when the user has made touch input

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Dava
:warning: Old Version Published before Godot 3 was released.

How do you make it that when you get touch the screen, the touch buttons become visible and after a few seconds (maybe 5) it becomes invisible until another touch input has been performed

:bust_in_silhouette: Reply From: ericdl

Monitor user input for a SCREEN_TOUCH event. If detected, show the buttons and start a timer. When the timer finishes, hide the buttons.

For example:

func _ready():
	set_process_input(true)


func _input(event):
	if (event.type == InputEvent.SCREEN_TOUCH): _show_buttons()
	
	
func _show_buttons():
	get_node("TouchScreenButton1").show()
	get_node("TouchScreenButton2").show()
	get_node("Timer").start()
	

func _hide_buttons():
	get_node("TouchScreenButton1").hide()
	get_node("TouchScreenButton2").hide()
	

func _on_Timer_timeout():
	_hide_buttons()

To test this on a pc, turn on emulate_touchscreen in Project Settings->Display.

Example project download: https://drive.google.com/file/d/0BwnfZQAEnciAWTUxTDh1N2ZrTTA/view?usp=sharing