+1 vote

Hi, i am in the making of a simple game and i want to make it for android. And i want to work it mostly through code, therefore i need to handle multiple touches at once.

in Engine by (1,193 points)

1 Answer

0 votes
Best answer

I never tried multitouch, but here is what I can guess from the documentation:

http://docs.godotengine.org/en/stable/classes/class_inputeventscreentouch.html

In the _input(event) callback, you can also get events of type InputEventScreenTouch. You would know an event is of this type by doing:

func _input(event):
    if event.type == InputEvent.SCREEN_TOUCH:
        # Do stuff with touch

These also contain an index property,
telling you what is the ID of the touch. So for example, if you touch with one finger you will receive an event with index 0, then if you touch with a second finger you will get a second event with index 1, etc. So you can tell them apart when further events of this type occur.

by (27,962 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.