How can i detect when the player touched a TouchScreenButton

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

i have a game and in the game there is a button that is supposed to move the player.
it is a touchscreen button but i cannot figure out how to detect when the player has touched it. i am a beginner with godot.

my code:
extends TouchScreenButton

var motion = Vector2()
func _physics_process(_delta):
	if (is_pressed()):
		print("p")

pass

i cant seem to press it when i run. this is an android game. it is set to print right now as a test but its not printing

Nevermind, i figured out that in the action property of touchscreenbutton, i can set an input to trigger, and from a script i can check if the input has been triggered and do something

rz | 2021-04-25 20:03