2 AnswersNew Answer
time of going up must be equal to time of getting down //in physics (ideal conditions) t=u/g //where u is vel. in dirn opp. to gravity(in ms^-1) & g=9.8ms^-2[units of same system] //h will be u^2/2g //but in real world , this formula fails for calculating exact value ... for game also , u must not use that ... ur wish☺
Use momentum. When you jump, momentum goes up. Gravity brings it down slightly every tick unless on ground or terminal velocity. Maybe by multiplication and momentum being a float or double.