this is my code for my Charater and when I run it i can move but I it does not jump can someone plase help, the animations for idle and run work fine but I cannot jump
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playercontroller : MonoBehaviour {
public Animator animator;
public float topspeed = 10f;
bool facingRight = true;
bool grounded = false;
public Transform GroundCheck;
float groundRadius = 0.2f;
public float jumpForce =700f;
public LayerMask whatIsGround;
void start ()
{
animator = GetComponent<Animator> ();
}
void FixedUpdate()
{
grounded = Physics2D.OverlapCircle (GroundCheck.position, groundRadius, whatIsGround);
animator.SetBool("Ground", grounded);
animator.SetFloat("vSpeed", GetComponent<Rigidbody2D>().velocity.y);
float move = Input.GetAxis ("Horizontal");
GetComponent<Rigidbody2D> ().velocity = new Vector2 (move * topspeed, GetComponent<Rigidbody2D> ().velocity.y);
animator.SetFloat ("Speed", Mathf.Abs (move));
if (move < 0 && !facingRight)
Flip ();
else if (move > 0 && facingRight)
Flip();
}
void Update()
{
if (grounded && Input.GetKeyDown (KeyCode.Space))
{
animator.SetBool ("Ground", false);
GetComponent<Rigidbody2D> ().AddForce (new Vector2 (0, jumpForce));
}
}
void Flip()
{
facingRight = !facingRight;
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
}
}