Physics2D.OverlapBox (C#)
I started an online course on unity, and I'm doing exactly like in classes. but in a script is giving error and I do not know what to do.
The Course: www.youtube.com/watch?v=F33-yeL1suU (it's in portuguese)
 private Rigidbody2D rb;
 private Transform tr;
 private Animator an;
 public Transform verificaChao;
 public Transform verificaParede;
 private bool estaAndando;
 private bool estaNoChao;
 private bool estaNaParede;
 private bool estaVivo;
 private bool viradoDireita;
 private bool estaPulando;
 private float axis;
 public float velocidade;
 public float forcaPulo;
 public float raioValidaChao;
 public float raioValidaParede;
 public LayerMask solido;
 // Use this for initialization
 void Start () {
     rb = GetComponent<Rigidbody2D> ();
     tr = GetComponent<Transform>();
     an = GetComponent<Animator>();
     estaVivo = true;
     viradoDireita = true;
 }
 // Update is called once per frame
 void Update () {
     estaNoChao = Physics2D.OverlapBox (verificaChao.position, raioValidaChao, solido);
     estaNaParede = Physics2D.OverlapBox (verificaParede.position, raioValidaParede, solido);
     if (estaNoChao) 
         estaPulando = false;
     
     if (estaVivo) {
         axis = Input.GetAxisRaw ("Horizontal");
         estaAndando = Mathf.Abs (axis) > 0f;
         if (axis > 0f && !viradoDireita)
             flip ();
         else if (axis < 0f && viradoDireita)
             flip ();
         if (Input.GetButtonDown ("Jump") && estaNoChao)
             estaPulando = true;
     }
 }
 void FixedUpdate(){
 
     if (estaPulando)
         rb.AddForce (tr.up * forcaPulo);
     if (estaAndando) {
         if (viradoDireita && !estaNaParede)
             rb.velocity = new Vector2 (velocidade, rb.velocity.y);
         else
             rb.velocity = new Vector2 (-velocidade, rb.velocity.y);
     }
         
 }
 void flip(){
     viradoDireita = !viradoDireita;
     tr.localScale = new Vector2 (-tr.localScale.x, tr.localScale.y);
 }
}
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
How can I isolate just the character to slow down 0 Answers
Remember position for a simple player controller (Left/Right)? 0 Answers
2d physics - get a shot object to bounce back off a wall 1 Answer
Player hiding inside Gameobject 1 Answer
How do I have my character aim where my mouse cursor is? 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                