Solved no help needed

Godot Version

extends CharacterBody2D

var speed : int = 10
var DAMAGE : int = 5
@onready var ray = %RayCast2D
@onready var sprite_slime = $AnimatedSprite2D
@onready var direction
@onready var player = %Player
var MAX_DISTANCE : int

func _physics_process(_delta: float) → void:
ray.target_position = player.position
print(player.position)
if ray.is_colliding():
sprite_slime.play(“Jump”)
direction = ray.get_collision_point()
velocity = direction * speed * _delta
elif !ray.is_colliding():
velocity = Vector2(0,0)
sprite_slime.play(“Idle”)
move_and_slide()


Question

When I use print(player.position) it sends a Vector2() of wherever my player is. I’m trying to make it so that my raycast is always on the player and when the player walks in range of the slime the slime will go to the player. The issue I’m facing is that the target_position property is not updating. The raycast is stuck.

How about using a circular area to detect the player, instead of a raycast.