Problems getting player position

Godot Version

4.6.2

Question

Ok so I am making a boss that follows the player and it seemed to work just fine, but now it is saying that it is a breakpoint. I think the issue is in getting thee player position but I’m not sure.

here is the code (also the break point is the direction = player.position - position):


@onready var player = get_parent().find_child("Player")
@onready var animated_sprite = $AnimatedSprite2D

var direction : Vector2


func _ready():
	set_physics_process(false)

func _process(_float) -> void:
	direction = player.position - position
	
	if direction.x < 0:
		animated_sprite.flip_h = true
	else:
		animated_sprite.flip_h = false
		
	
func _physics_process(delta):
	velocity = direction.normalized() * 40
	move_and_collide(velocity * delta)

func damaged():
	animated_sprite.play("damaged")

breakpoint means you’ve a place in code for the debugger to intentionally stop so you may debug non-broken code. There’s probably a red dot beside your line number, if you click the red dot it will remove the breakpoint, clicking in the “gutter” where line numbers are will add a the breakpoint again. If you want to use a breakpoint intentionally in the future you can write breakpoint in code to do the same.

2 Likes

oh my god thank you that was it