# calculate distance travelled in infinite jumping game

0 favourites
• 7 posts
From the Asset Store
A procedurally generated infinite runner in 3D for Construct 3!
• hi guys I am making an infinite jumping game project which is similar to infinite jumping game template provide by construct 2. Now I want to ask you guys how to calculate the distance travelled by the character, which means how height the character has jumped already. Sorry that I can't attach the project here due to my rep below 500.

• You couldn't attach it even then, its been borked for awhile... use an external free file host like dropbox then post the text version of the url until you get url capabilities.

Follow the code provided in this thread but change X values to Y:

https://www.scirra.com/forum/viewtopic.php?f=147&t=128393

In your case you won't have a finish Y, so just use the start Y and current Y to calculate distance in pixels travelled upward. You can convert that into whatever measurement you like as well (ie. pixel = a foot, divide by 13 and call them Quadroons, whatever fits your game).

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• hi , I do not understand what you are talking about. here is my game project capx dropbox.com/s/wvj9pxth6hw3t ... .capx?dl=0

Can you help me calculate the distance travelled? Thank you

• I tried to open the capx but dropbox says it can't find it (yes, I took out the ...).

My prior explanation only works if your using a set background image and scrolling downward. If your making a true infinite jumper then you will need to measure the height of jumps and add them to a variable that is shown as total height jumped. But the idea is basically the same. You grab current Y when jump is pressed and the max Y when falling animation kicks in or you land. Then you can take the difference and add it to a height variable to post.

The thread I linked to has all the code you just need to remember your using Y and not X values... and your going up so Y values will be subtracting...

• ,,,,just a thought...

capx: