Looking at the code posted, and I could be wrong on this, but I think the issue is your indentation. The _on_StompDetector_body_entered
has a queue_free
that, if I am correct, should be further indented so the enemy is only destroyed when touching the StompDetector
node. The following should have the correct indentation:
func _on_StompDetector_body_entered(body: PhysicsBody2D) -> void:
if body.global_position.y > get_node("StompDetector").global_position.y:
get_node("CollisionShape2D").disabled = true
queue_free()
return
Also, welcome to the forums! :smile: