i add motion to player but i want to calculte max Y coordinate i can use for loop PHP: $gravity //entity gravity$motion = 5;$maxY = 0;while($motion > 0){ $maxY += $motion; $motion -= $gravity;} but its not good i think and there must be direct calculation

Time for some physics or mathematics. https://en.wikipedia.org/wiki/Equations_of_motion#Kinematic_equations_for_one_particle Summary: I guess these equations can answer your question. For example, when an object is thrown upwards at the initial velocity of u ms-1, with downwards gravity of g ms-2 to find the maximum height h (assuming the object is thrown from the ground): The object has velocity 0 when it is at the highest position (previously positive velocity, changing to negative velocity). Therefore, using this equation: Code: v^2 = u^2 + 2as (4) To substitute variables: 0 = u^2 + 2 (-g) (h) We want to find h, so make h the subject of this equation: 2 gh = u^2 h = u^2 / 2g Hence, you can write this formula for h into your program: PHP: public function maxHeight($initialVelocity, $gravity){ // gravity is negative, because we take upward direction as positive return ($initialVelocity ** 2) / (2 * (-$gravity));} See this thread for more information about using equations in programming.

There is actually no difference at all, other than two extra pairs of parentheses that may make monsters from the root of all evil target at you.