When the player loads off of the main menu, they are presented with the image of their rocket and the upgrades screen.
When they click launch the rocket has 2 main variables that affect the velocity it goes at, and therefore how far it can ultimately travel. The force produced by the thrusters and gravity.
Every second the rocket is accelerated upwards by the thrusters and then straight afterwards it is accelerated downwards by the force of gravity. As long as the thrusters produce enough force to counteract gravity the rocket will continue to travel upwards.
When the rocket runs out of fuel, it continues to travel until gravity slows it down back to 0 m/s. At that point, we know the rocket will not be travelling any further and the distance travelled is calculated and converted into coins for the user to upgrade their rocket further.