You can measure the distance between two points with the expression:
"distance(x1, y1, x2, y2)"
At the beginning of your flight have the system to create an Object:Sprite, and when you need to measure the distance, measure it from this Object to your Players hitbox (or similar).
If you've chopped up your layout into seveal wide layout screens as the user above has mentioned. So that your player wraps at X=??? and is repositioned to X=0 at a greated Y value. Then calculate your distance as previously suggested but also add on the layout width multiplied by how many times you've wrapped.