![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | cvetirodrigez |
So when I click on the screen I want the bullet to go in this position. It’s working but when it reaches the end point its moving to left and right
this is the position of touch X538 Y181
the bullet is changing from X542 to X521
area2d
var touchPos = Vector2()
var speed = 22
func _process(delta):
var direction = (touchPos - get_global_position())
position += direction.normalized() * speed
func _input(event):
if event is InputEventScreenTouch:
touchPos = event.get_position()
I guess it’s because of normalized. So how can I fix it?