Could it be that the body in the first function is the child of another node? What could fix the problem, in that case, is using the global_position
instead of the normal position
.
Like this:
func _on_side_checker_body_entered(body):
body.hurt(global_position.x)
It might be necessary to change the position
in your hurt
function to global_position
too.
position
is always relative to the parent of that node, while global_position
is the position relative to the root node.