Error at (41, 21): Identifier Expected
What does this error mean and how can I fix it in this context?
public class PlayerMovement : MonoBehaviour
{
public Rigidbody2D rb; //Rigidbody
public float facing; //The direction the player is facing (-1/1,left/right)
// Start is called before the first frame update
void Awake()
{
rb = GetComponent();
facing = 1;
}
// Update is called once per frame
void Update()
{
if (Input.GetKey(KeyCode.A))
{
facing = -1;
Walk(facing);
}
else if (Input.GetKey(KeyCode.D))
{
facing = 1;
Walk(facing);
}
}
void Walk(facing) <-ERROR ON THIS LINE
{
rb.velocity = new Vector2(20*facing, rb.velocity.y)
} //This make it so if the player presses the run button at a standstill, they'll run in the last direction they walked
}
↧