I have made a state machine to handle two states of the enemy: Wander, Chase.
My problem is that I was learning from a code made for a top view type game and I am dealing with a 2D platformer.
What would be the best way to calculate the distance between player and enemy so I can set a treshold for switching the states?