| Attention | Topic was automatically imported from the old Question2Answer platform. | |
| Asked By | KitePZ |
I have a TouchScreenButton that player can press directly. However, I also need it to be periodically pressed by an NPC. I thought it was gonna be as simple as something like $TouchScreenButton.pressed = true, but it doesn’t seem to be like this. I tried to simulate a touch like that:
onready var button = $TouchScreenButton
func bird_button_press():
var touch = InputEventScreenTouch.new()
touch.position = button.global_position
touch.pressed = true
but not sure I’m doing it properly andbutton.is_pressed() always returns false. The correct way to do it is probably easy, but I don’t have much experience to tell what’s wrong.