Hi,
Somehow this part of my code is being ignorded: && Difference < 0.5f
When I use == instead of > it functions properly.
void Update ()
{
float Difference = player1.transform.position.x - transform.position.x;
if (Input.GetKeyDown (KeyCode.Space) && Difference > 0.5f)
{
Debug.Log (player1.transform.position.x);
Debug.Log (transform.position.x);
Debug.Log (Difference);
}
}
The Debug.Log (Difference) shows that when Difference > 0.5f the if statement still is ‘true’.
Can somebody please help me with my problem?
Thanks in advance!