0 votes

Hey, im new to Godot and im trying to make an Enemy that chases the player.
My problem is, that the enemy just flies to the top left corner.

extends KinematicBody2D

var direction = Vector2.ZERO
onready var Spieler = get_node("/root/World/Spieler")
var Speed = 60

func _physics_process(delta):
    var to_player = ($"../Spieler".position-position).normalized()
    direction = to_player * Speed
    move_and_collide(direction * delta)
in Engine by (12 points)

Does it work if you use the global_positions?

Already tried, didnt change anything sadly

Fair enough. I would check the values of the positions, as it looks like it should work.

Please log in or register to answer this question.

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 Frequently asked questions and 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 [email protected] with your username.