My game require constant update of a var with a drag gesture postion as my finger is moving on the touch sreen please help as im pretty new to programming.
Asked
Active
Viewed 242 times
0
-
1It's hard to tell what you're asking for, but a good place to start would be to look at using the InputEventScreenTouch() function to capture the screen press as well as the co-ordinates of the press. To make sure it updates every frame, put all the associated logic in the _process() function. – Christopher Bennett Apr 25 '20 at 12:33
1 Answers
0
By default, when you touch the screen, Godot interprets that as a mouse motion, so to get the position whenever the user has their finger on the screen you can do:
func _input(event):
if event is InputEventMouseMotion:
gesturePostion = event.position
Now you have the variable 'gesturePostion' which stores the position of your finger on the screen as a Vector2. Just make sure you've defined 'gesturePostion' as a global variable (you can do that by defining the variable outside any function).

Alex
- 47
- 3
- 9