Error CS8025: Parsing error?
This may be a dumb question, but I have a parsing error in anim.setFloat("LastMoveY", lastMove.y); I have no idea to fix. (42,55) Error CS8025: Parsing error (last one is 42,55). When I delete that line of code, I get another error in 41,55. There's another parsing error if I delete that line as well. I need help.
using UnityEngine; using System.Collections;
public class JimController : MonoBehaviour {
public float moveSpeed;
private Animator anim;
private bool playerMoving;
private Vector2 lastMove.x;
private Vector2 lastMove.y;
// Use this for initialization
void Start () {
anim = GetComponent<Animator>();
}
// Update is called once per frame
void Update () {
playerMoving = false;
if(Input.GetAxisRaw("Horizontal") > 0.5f || Input.GetAxisRaw("Horizontal") < 0.5f )
{
transform.Translate (new Vector3(Input.GetAxisRaw("Horizontal") * moveSpeed * Time.deltaTime, 0f, 0f));
playerMoving = true;
lastMove = new Vector2(Input.GetAxisRaw("Horizontal"), 0f);
}
if(Input.GetAxisRaw("Vertical") > 0.5f || Input.GetAxisRaw("Vertical") < -0.5f )
{
transform.Translate (new Vector3(0f, Input.GetAxisRaw("Vertical") * moveSpeed * Time.deltaTime, 0f));
playerMoving = true;
lastMove = new Vector2(0f, Input.GetAxisRaw ("Vertical"));
}
anim.SetFloat("MoveX", Input.GetAxisRaw("Horizontal"));
anim.SetFloat("MoveY", Input.GetAxisRaw("Vertical"));
anim.SetBool("PlayerMoving", playerMoving);
anim.SetFloat("LastMoveX", lastMove.x);
anim.SetFloat("LastMoveY", lastMove.y);
Answer by Highwalker · Apr 19, 2016 at 06:28 AM
Your update is missing a closing bracket "}"
That is totally up to you, within reason.
Class
{
function
{
if-statements-etc
{
}
}
function
{
}
}
In $$anonymous$$ono / VS, click the bracket and it will show you to opposing bracket by highlighting it. $$anonymous$$ake sure that each opening bracket has a closing bracket of matching flavour( () {} [] ) and follow the general outline Ive written there.
Generally if youve missed a bracket at the end of the function it needs to be placed just before the next function. I mean, you cant put it inside the next function and you cant place it early or you'll have code left out in the cold.
Tried it and got rid of the parsing error. Now I have "A namespace can only contain types and namespaces" error on "void Start" and "void Update". This is frustrating.
Once again check that the format is what meat5000 said
using xxx.yyy.zzz;
Class
{
function
{
if-statements-etc
{
}
}
function
{
}
}
$$anonymous$$ost likely now you have something outside the class' curlies that should be inside them
That's because of...
private Vector2 last$$anonymous$$ove.x;
private Vector2 last$$anonymous$$ove.y;
Still nothing. using UnityEngine; using System.Collections;
public class JimController : $$anonymous$$onoBehaviour {
public float moveSpeed;
private Animator anim;
private bool player$$anonymous$$oving;
private Vector2 last$$anonymous$$ove.x;
private Vector2 last$$anonymous$$ove.y;
} // Use this for initialization void Start () { anim = GetComponent(); }
// Update is called once per frame
void Update () {
player$$anonymous$$oving = false;
if(Input.GetAxisRaw("Horizontal") > 0.5f || Input.GetAxisRaw("Horizontal") < 0.5f )
{
transform.Translate (new Vector3(Input.GetAxisRaw("Horizontal") * moveSpeed * Time.deltaTime, 0f, 0f));
player$$anonymous$$oving = true;
last$$anonymous$$ove = new Vector2(Input.GetAxisRaw("Horizontal"), 0f);
}
if(Input.GetAxisRaw("Vertical") > 0.5f || Input.GetAxisRaw("Vertical") < -0.5f )
{
transform.Translate (new Vector3(0f, Input.GetAxisRaw("Vertical") * moveSpeed * Time.deltaTime, 0f));
player$$anonymous$$oving = true;
last$$anonymous$$ove = new Vector2(0f, Input.GetAxisRaw ("Vertical"));
}
anim.SetFloat("$$anonymous$$oveX", Input.GetAxisRaw("Horizontal"));
anim.SetFloat("$$anonymous$$oveY", Input.GetAxisRaw("Vertical"));
anim.SetBool("Player$$anonymous$$oving", player$$anonymous$$oving);
anim.SetFloat("Last$$anonymous$$oveX", last$$anonymous$$ove.x);
anim.SetFloat("Last$$anonymous$$oveY", last$$anonymous$$ove.y);
}
Answer by Blind_Eye_Gaming · Nov 26, 2016 at 03:34 AM
Also get the same error as them but I cant but in a bracket without getting errors
void Update () {
if (Input.GetKey (shoot)) {
Vector3 sp = Camera.main.WorldToScreenPoint(transform.position);
Vector3 dir = (Input.mousePosition - sp).normalized;
rigidbody2D.AddForce (dir * amount);
}
}
Your answer
Follow this Question
Related Questions
error CS8025: Parsing error 0 Answers
error CS8025 (Parsing Error) 1 Answer
Parsing Error 0 Answers
Simple light switch problem 0 Answers
Parsin Error (C#) 2 Answers