- Home /
 
               Question by 
               MrBigCheese · Jun 24, 2014 at 01:46 AM · 
                animationanimatorcontrollers  
              
 
              My player won't jump?
So i was following the TUT, Live Training 16 Dec 2013 2D Character Controllers and i got to the final bit where you add the Jump and my player doesn't jump any idea why?
 using UnityEngine;
 using System.Collections;
 
 public class PlayerController : MonoBehaviour 
 {  
      public float maxSpeed = 10f;
      bool facingRight = true;
 
     Animator anim;
 
     bool grounded = false;
     public Transform groundCheck;
     float groundRadius = 0.2f;
     public LayerMask whatIsGround;
     public float jumpForce = 700f; 
 
     void Start () 
     {
         anim = GetComponent<Animator> ();
     }
 
     void FixedUpdate () 
     {
         grounded = Physics2D.OverlapCircle (groundCheck.position, groundRadius, whatIsGround);
         anim.SetBool ("Ground", grounded);
 
         anim.SetFloat ("vSpeed", rigidbody2D.velocity.y);
 
 
         float move = Input.GetAxis ("Horizontal");
 
         anim.SetFloat ("Speed", Mathf.Abs (move));
 
         rigidbody2D.velocity = new Vector2(move * maxSpeed, rigidbody2D.velocity.y);
 
         if (move > 0 &&!facingRight)
             Flip ();
         else if (move < 0 && facingRight)
             Flip ();
     }
 
     void update()
     {
         if(grounded && Input.GetKeyDown(KeyCode.Space))
         {
             anim.SetBool("Ground", false);
             rigidbody2D.AddForce (new Vector2(0, jumpForce));
 
         }
     }
 
     void Flip()
     {
         facingRight = !facingRight;
         Vector3 theScale = transform.localScale;
         theScale.x *= -1;
         transform.localScale = theScale;
     }
 }
               Comment
              
 
               
              What's the value of "grounded" during update ? Is it always false ? or changing really fast from true to false ?
Answer by Maerig · Jun 24, 2014 at 09:11 AM
Try Update with a capital U. 
As always stated before by many and by UA FAQ,
"If you ask a question and someone writes a helpful reply, make sure to mark that reply as the answer! (Click the check-mark icon to make it green.)"
Since it is the best way to say thank you to the answerer. :-)
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                