I am making a simple game and i need my player to jump. They way i want to do it i get the error: Operator '&&' cannot be applied to operands of type 'bool' and 'float'. Here is my script:
public class Jump : MonoBehaviour
{
public Rigidbody rb;
public float UpForce = 2000f;
public float jumpCount;
void FixedUpdate()
{
if (Input.GetKey("w") && jumpCount = 0)
{
rb.AddForce(0, UpForce * Time.deltaTime, 0, ForceMode.Impulse);
jumpCount = 1f;
}
}
void OnCollisionEnter(Collision collisionInfo)
{
if (collisionInfo.collider.tag == "Floor")
{
jumpCount = 0f;
}
}
↧