If the enemy is at ex, ey and the player is at px, py, just check if ex == px and ey == py. Demo attached.