i am trying to give a effect if jump up fast. slow down at top. and come down fast. and stop on ground.
Give a higher starting jump speed than used in the example. Then increase the downward pull of gravity to compensate. Adjust both values until the jump gives the arch you desire.
please see the
announcements page for the use of code tags.
In post #8 the code has an infinite loop. I do not understand what the code is supposed to do.
is dy -height can player jump?
velocity_Y - fast can player jump?
There is no reason to calculate how high a player can jump. You add an upward force to a player's vertical speed, and they begin to go up. As long as they have a vertical speed of any value the player is either moving up or down. The height a player jumps depends on the height the player is at when jumping, and how much upward force is applied. Once that push has been given to the player, all of the code that has to do with the jump is finished. From that point forward the code that normally moves the player is responsible for completing the upward move, the float at the climax, and the landing. I get the impression you are trying to do all of the move in the jump method. Maybe you are. Maybe that is the effect you want.
I feel like my hints of how some things work are turning into a "write your code my way" post. That is not my intention. I suggest you get a good idea of what you want to happen, and write down the steps to make it happen. Finally turn those steps into code.