# Fixed jumping in platformer jump

I am making a platformer game and implemented jumping, but I have an issue,when I multiply the JUMP VALUE with Time.deltaTime , the value is slightly different every time.
Is it possible to make the player jump with same value every time the player jumps? Here is my code.

``````	void Update () {
if(gameManager.paused) return;

isPressed  =  false;

if (Input.GetKey(KeyCode.LeftArrow) || isBtnLeft)
{
isPressed = true;
xSpeed -= (SPEED_STEP*Time.deltaTime);

xSpeed = xSpeed<-MAX_X_SPEED ?-MAX_X_SPEED:xSpeed;
}
if (Input.GetKey(KeyCode.RightArrow) || isBtnRight)
{
isPressed = true;
xSpeed += (SPEED_STEP*Time.deltaTime);

xSpeed = xSpeed>MAX_X_SPEED ?MAX_X_SPEED:xSpeed;
}

if (Input.GetKeyDown(KeyCode.UpArrow) || isBtnJump){
if(!isJumping){
isBtnJump = false;
isJumping = true;
squish(0.5f,1.4f);
float currentJumpSpeed = (jumpSpeed*Time.deltaTime);
currentJumpSpeed = currentJumpSpeed>MAX_JUMP_SPEED ? MAX_JUMP_SPEED:currentJumpSpeed;
ySpeed += jumpSpeed;
}
}else
ySpeed -=(gravity*Time.deltaTime);

ySpeed = ySpeed<MAX_FALL_SPEED ? MAX_FALL_SPEED:ySpeed;

if (Mathf.Abs(xSpeed)<1&&! isPressed) {
xSpeed=0;
}

collisionY();
collisionX();

xSpeed *=hFriction;

}
}
``````

What if i dont multiple the jumpSpeed with delta time?

Thanks

I assume you have code that is decreasing the Y speed value every frame, accounting for gravity. If so, your jump speed should not be based on time. Let’s call it an initial input velocity instead. If you jumped with an initial velocity of say 20 ft/s every time, then you would start in frame 0 of the jump with an upward velocity of 20, and each frame thereafter, the upward velocity would decrease by the acceleration over time. In other words, you would account for frame time when determining how far the player has fallen back to the ground between two frames, but the first frame would always be 20 ft up. So I think you just want to set an “initial velocity” up (no frame time concerns) and then subtract from that each frame based on the change in velocity since the last frame due to gravity, which is just the gravity (m/s)/s multiplied by deltaTime. Then move the player down a distance by the “current velocity” each frame, which again is just velocity (m/s) multiplied by deltaTime.