Please help just stuck on this part on my script for my mecanim controller I need to add a jump / double jump to this
using UnityEngine;
using System.Collections;
public class Movement : MonoBehaviour {
Animator anim;
bool grounded = false;
public Transform groundCheck;
float groundRadius = 0.2f;
public LayerMask whatIsGround;
// Use this for initialization
void Start () {
anim = GetComponent<Animator> ();
}
void FixedUpdate (){
grounded = Physics2D.OverlapCircle (groundCheck.position, groundRadius, whatIsGround);
anim.SetBool ("Ground", grounded);
}
// Update is called once per frame
void Update () {
float input_x = Input.GetAxisRaw ("Horizontal");
float input_z = Input.GetAxisRaw ("Vertical");
bool IsWalking = (Mathf.Abs (input_x) + Mathf.Abs (input_z)) >0;
anim.SetBool ("IsWalking", IsWalking);
if (IsWalking)
{
anim.SetFloat ("x", input_x);
anim.SetFloat ("z", input_z);
transform.position += new Vector3(input_x, 0f, input_z).normalized * Time.deltaTime;
if (grounded && Input.GetKeyDown (KeyCode.Space))
{
anim.SetBool ("Ground",false);
}
}
}
}
Any suggestions?