I want it so whenever I am not colliding with the pressure plate the boolean is false.
This is probably easily solved but I am new to coding, still would appreciate the help.
(It’s a 2D game)
Here is my script :
//Pressure plate variables
public bool pressurePlate = false;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (pressurePlate == true) {
GetComponent<Animation>().Play ("pressurePlateDown");
}
if (pressurePlate == false) {
GetComponent<Animation>().Play ("pressurePlateUp");
}
}
void OnCollisionEnter2D(Collision2D other){
if (other.transform.tag == "Player") {
pressurePlate = true;
}
}
}