i have been trying so hard to get this to work and tried multiple methods. all i want to do is make the enemy always face towards the player on the x axis. heres what i got (game crashes when the enemy comes into view):
extends KinematicBody2D
signal is_colliding
signal is_not_colliding
const BULLET = preload("res://bullet.tscn")
var direction = 1
var shoot = false
onready var player = get_node("res://Player.gd")
func _ready():
pass
func _physics_process(delta):
$dealer.flip_h = direction.to_local(player.global_position).x < 0