Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Game Development How to Make a Video Game Player Input and Cameras Move the Player with Animation

My play button isn't working. My script for mono script said it had a bunch of errors, and my Unity is also error filled

Here is my mono script page: using UnityEngine; using System.Collections; using System.Collections.Generic; public class PlayerMovement : MonoBehaviour { private Animator player Animato(r; private float moveHorizontal private float moveVertical private Vector3 movement // Use this for initialization void Start () {

}

// Update is called once per frame
void Update () {
    moveHorizontal = Input.GetAxisRaw ("Horizontal");
    moveVertical = Input.GetAxisRaw ("Vertical");

    movement = new Vector3 (moveHorizontal, 0.0f, moveVertical); 
}

}

1 Answer

Henrique Vignon
PLUS
Henrique Vignon
Courses Plus Student 6,415 Points

Well, it's really hard to read the code like this, you can paste the code in between 3 back sticks so it retains it's format with indentation and all (check the mark down sheet to see a better explanation on how to do that).

But for what I can see you forgot a bunch of semicolons at the line ends of your variable declarations, plus you wrote

private Animator player Animato(r;

and it should be

private Animator playerAnimator;

When declaring variables you can never use spaces or special characters such as "(", when you put in a space the compiler thinks you're done with that variable and looks for a semicolon to end the instruction or a "=" for assignment.

I suggest you re-watch the video and take close attention when the teacher writes the script, it's a good idea to just wait till he does it, listen to his explanation, then pause the video and write it yourself.