When i start my game Unity sais that there are compiler errors that i have to fix first. I searched in my code and i think i located the place where the errer is.
this is the whole code:
using UnityEngine;
using System.Collections;
public class Playermovement : MonoBehaviour {
public Animator anim;
public int verticalMovement;
public bool isWalking;
public bool onGround;
public float fallSpeed;
// Use this for initialization
void Start () {
isWalking = false;
verticalMovement = 0;
onGround = true;
fallSpeed = 0.03f;
}
// Update is called once per frame
void Update () {
//if you are on the ground and press space verticalmovement will we be places on 1.
if (Input.GetKeyDown(KeyCode.Space) == true && onGround == true)
{
verticalMovement = 1;
onGround = false;
}
else
{
if (onGround == false && verticalMovement > 0)
{
verticalMovement -= fallSpeed;
if (verticalMovement < 0)
{
verticalMovement = 0;
onGround = true;
}
}
}
// Update the animator variables
anim.SetFloat("VerticalMovement", verticalMovement);
anim.SetBool("OnGround", onGround);
}
}
and this is where i think the error is:
else
{
if (onGround == false && verticalMovement > 0)
{
verticalMovement -= fallSpeed;
if (verticalMovement < 0)
{
verticalMovement = 0;
onGround = true;
}
}
}
I hope you can help me :).