PLS HELP!!! My code dont work

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

I was trying to make it reaching the Point and after reaching the objekt shoudnt stop but they are Always stoping at the Point.

extends KinematicBody2D

export (int) var speed = 500

var target = Vector2()
var velocity = Vector2()
var used = false

func _physics_process(delta):
	velocity = (target + position).normalized() * speed
	velocity = move_and_slide(velocity)

Could you please give more detail? The title doesn’t include any details about your issue what-so-ever, so people wouldn’t be very inclined to help you.

Your problem is that the object in question is stopping when you don’t want it to? The code you have provided works for me, and I continue to move. Is there code you’re not providing that may be causing the issue? Or perhaps you have a collision object in the way that you just forgot about?

Kyle Guarco | 2019-08-12 19:11

Please add more details
The code works for me
And the object does not stop

mustafamax | 2019-08-14 09:07