Welcome to the forums @LucianoLB!
Probably the easiest and most flexible way to detect if the player has collided with an enemy or any other object is to add an Area2D node as a child node of the player, with a collision shape that is the same size (or slightly larger) than the collision shape node used for the KinematicBody2D. Then you can use the on_body_entered
and on_body_exited
signals to detect collisions.
You can also use the get_slide_collision
(documentation) function if you use move_and_slide
and then parse the KinematicCollision2D
data to detect what the player has collided with. I have not really done this myself, but it might be helpful and would avoid the additional Area2D node, though I think it is not quite as flexible and I'm not sure it would detect enemies colliding with the player when the player is not moving towards the enemy.