the var direction is always reading seek_player() as Nil
func _physics_process(delta):
seek_player()
if is_idle == true:
var direction = (seek_player() - global_position).normalized() # this is the problem child
# the goal of this is to move the enemy towards the player if is_idle is true. even though the moving part isnt there yet, i am hardstuck on debugging the f***ing direction variable.
move_and_slide()
however, a similar operation was done somewhere else without a problem.
## simple function to teleport minos next to the player
func teleport_to_player():
global_position = seek_player() + Vector2(randi_range(-20, 20), randi_range(-20, 20)) # here!
blue_flash.rotation_degrees += randi_range(0, 360) * 1 * randi_range(1, 3)
blue_flash_2.rotation_degrees += randi_range(0, 360) * -1 * randi_range(1, 3)
print(self.global_position)
# checks whether or not the player is within aggro range. if it is, updates target position and returns it.
# target is used for minos's teleportation.
func seek_player():
var target = playerdetectionzone.player_pos
return target