If the mushroom walks into the player from the side

The player will be hurt.

To do this add a new zone to the mushroom

Use an Area2D and two CollisionShape2D

Use RectangleShape2D for the CollisionShapes

Place them on either side of the mushroom.

Now Connect the body_entered signal of the HurtPlayerZone

Write code to call the Player's Hit function

When the player is hit by a mushroom.

Return to the Player script.

Add a variable called health and set it to 3

Add a function called hit

In the function reduce player health by 1

Play the Hit animation.