How do I calculate the total distance traveled walking around environments?

i get the way you are trying to calculate the distance but sqrt(x^2+y^2) will give the displacement vector from the origin but i want the actual distance travlled as i have made a endless runner game wich can turn 90 degrees so this method wont work in that if you know anyother way pls tell me