I have had this error before, but it was a simple mistake. This time i cannot find any errors in my code, but it says that there are some there…
using UnityEngine;
using System.Collections;
public class HenryControlsScript : MonoBehaviour
{
public float maxSpeed = 20f;
bool facingRight = true;
Animator anim;
bool grounded = false;
public Transform groundCheck;
float groundRadius = .2f;
public LayerMask whatisGround;
public float jumpForce = 700f;
// Use this for initialization
void Start ()
{
anim = GetComponent<Animator>();
}
// Update is called once per frame
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() // it says that this 'void' here is not usable
{
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;
}
}
Thanks for anyone’s help.