My jump scripit wont work. i have been tryingtt o make it work for an eternity. please help.
This is my scrpit
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Jump : MonoBehaviour
}
private bool jumping = false;
public float jumpHeight;
public Rigidbody2D rb3;
private void FIxedUpdate()
{
if (Input.GetKey("w") & ( jumping = false))
{
rb3.AddForce(new Vector2(0, 10 * Time.deltaTime),
ForceMode2D.Impulse);
// jumping = true;
}
}
}
i really dont know what is wrong with it i looked verywhere and i cant find an answer. Please help.
Comment
Answer by highpockets · Aug 20, 2020 at 10:49 PM
FIxedUpdate
has to be FixedUpdate
&
has to be the conditional logical AND operator expressed like so &&
and in the same condition you are trying to check if jumping is equal to false and not using the equality operator. This jumping = false
has to be expressed like this jumping == false
Or shorthand like this !jumping
Your answer
Follow this Question
Related Questions
Jump logic issues 0 Answers
Player looses ability to jump further right player moves. 1 Answer
Why does my player weirdly clip into environment when jumping? 0 Answers
How to add a jump key 2 Answers