I don't know if this is an easy way.
Have three private variables first: Ox, Oy, TD
Ox = car's old X position.
Oy = car's old Y position.
TD = Total distance.
now calculate the distance between old position and now position.
Start
- Set Ox = Car.X
- Set Oy = Car.Y
Always
- Add private variable "TD" = distance(Ox, Oy, Car.X, Car.Y)
- Set Ox = Car.X
- Set Oy = Car.Y