Player position resets when I hit the walls or floor instead of just the enemy.

So I want my player’s position to reset to its initial position whenever it collides with the enemy. This happens but it also resets when I hit the walls or if I jump and hit the floor.

Here is my code. I made sure that the enemy has an Enemy tag.
7613863--946087--upload_2021-10-29_11-42-51.png

Don’t put semicolons after if statements.

The compiler sees this as: “If this is an enemy, then do nothing because we have an empty statement which is ended by that semicolon. On an unrelated note, set the position to _initialPosition.”

1 Like

Wow, I can’t believe it was that simple. I was stuck on this for hours. Thank you so much!