calculate distance travelled in infinite jumping game

Get help using Construct 2

Post » Tue Apr 07, 2015 4:02 am

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.
B
6
Posts: 49
Reputation: 354

Post » Tue Apr 07, 2015 5:15 am

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).
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
51
S
14
G
8
Posts: 592
Reputation: 8,556

Post » Wed Apr 08, 2015 9:00 am

Message: Hardyanto can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
hi @chrisinfinger , I do not understand what you are talking about. here is my game project capx https://www.dropbox.com/s/wvj9pxth6hw3t ... .capx?dl=0
Can you help me calculate the distance travelled? Thank you
B
6
Posts: 49
Reputation: 354

Post » Wed Apr 08, 2015 10:04 am

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...
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
51
S
14
G
8
Posts: 592
Reputation: 8,556

Post » Wed Apr 08, 2015 2:42 pm

Image
B
60
S
23
G
7
Posts: 1,461
Reputation: 10,661

Post » Wed Apr 08, 2015 9:31 pm

Cool, I got ~9550 first try (*mumbles*.. then 1595, 1430...) good one Korbaach.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
51
S
14
G
8
Posts: 592
Reputation: 8,556

Post » Wed Apr 08, 2015 10:48 pm

Thanks @chrisinfinger :)
...It was just a thought..to use Scroll variable for Score(height)
Image
B
60
S
23
G
7
Posts: 1,461
Reputation: 10,661


Return to How do I....?

Who is online

Users browsing this forum: jhjconstruct, QuantumMMX and 11 guests