Hello :)
I've just done double jump in my game and in a some way it's affected by changing velosity.y by game object. It means the power of second jump depends on a time(?) and changing velosity.y(?) between double clicking "Space". I want to make it independent and the jump's power is need to be the same all the time. Where am I wrong?
Thanks in advance!
Tomas
void Update ()
{
if(Input.GetKeyDown(KeyCode.Space))
{
if(grounded)
{
rigidbody2D.AddForce(new Vector2(0f, jumpingForce * moving));
grounded = false;
jumpCounter = 1;
}
else if(!grounded && jumpCounter == 1)
{
jumpCounter++;
rigidbody2D.AddForce(new Vector2(0f, jumpingForce * moving));
//Debug.LogError("And second jump");
}
}
}
↧