Hey guys, I made a game in which the Player jumps and I need to count the distance he has jumped... can anybody help me how to do it, please? Thanks! <img src="smileys/smiley2.gif" border="0" align="middle" />
You would need variables to hold the starting point of the jump. Then at the end of the jump you can compare the points from the saved starting point with the point that the player is at to figure out the distance.
You'd start by making two global variables:
In the event that starts the jump (let's say pressing the spacebar) you would do something like this:
Keyboard: on key "spacebar" pressed
Then, once the player lands you would use:
distance(StartX,StartY,Player.X,Player.Y) to find the distance.
Develop games in your browser. Powerful, performant & highly capable.