Question by
Adesir35 · Feb 02, 2016 at 11:22 PM ·
error message
not all code paths return a value and must declare a body for CheckIsValidPosition()
code errors are stemming from the bool CheckIsValidPosition() { Here is the code:
float fall = 0; public float fallSpeed = 1;
public bool allowRotation = true;
public bool limitRotation = false;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
CheckUserInput();
}
void CheckUserInput()
{
if (Input.GetKeyDown(KeyCode.RightArrow))
{
transform.position += new Vector3(1, 0, 0);
}
else if (Input.GetKeyDown(KeyCode.LeftArrow))
{
transform.position += new Vector3(-1, 0, 0);
}
else if (Input.GetKeyDown(KeyCode.UpArrow))
{
transform.Rotate(0, 0, -90);
}
else if (Input.GetKeyDown(KeyCode.DownArrow) || Time.time - fall >= fallSpeed)
{
transform.position += new Vector3(0, -1, 0);
fall = Time.time;
}
}
bool CheckIsValidPosition() {
}
Comment
Your 'CheckIsValidPosition' method has no body to it (missing '}') and wants to return a boolean but currently doesn't return anything.
Best Answer
Answer by Jessespike · Feb 03, 2016 at 05:16 PM
The function is supposed to return a bool.
return false;
Your answer
