So I'm using the (x,y) position of the player and the enemy to set the angle so the enemy can follow the player. Everything goes well until I kill the enemy. When the player or the enemy dies the game crashes and I get the null object error. I have added the condition "if player and enemy is alive" but it haven't solved the problem. I can't understand why I keep getting this error.
I will attach the game archive if someone wants to look.