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.

Cameron Button
1,084 PointsFrog does not move when I press arrow keys, stays in idle animation
Finished the basic code, when I try and preview the game the frog stays in place and is still in the Idle animation.
"using UnityEngine; using System.Collections;
public class PlayerMovement : MonoBehaviour {
private Animator playerAnimator;
private float moveHorizontal;
private float moveVertical;
private Vector3 movement;
// Use this for initialization
void Start() {
playerAnimator = GetComponent<Animator>();
}
// Update is called once per frame
void Update() {
moveHorizontal = Input.GetAxisRaw("Horizontal");
moveVertical = Input.GetAxisRaw("Vertical");
movement = new Vector3(moveHorizontal, 0.0f, moveHorizontal);
}
void fixedupdate () {
if (movement != Vector3.zero) {
playerAnimator.SetFloat("Speed", 3f);
} else {
playerAnimator.SetFloat("Speed", 0f);
}
}
}"
1 Answer

Jennifer Nordell
Treehouse TeacherSorry for the delay. I only see two things that are obviously incorrect so far. This line:
movement = new Vector3(moveHorizontal, 0.0f, moveHorizontal);
should be this:
movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
And your fixedupdate method should be renamed to FixedUpdate as such:
Change this:
void fixedupdate () {
To this:
void FixedUpdate () {
It seems you've accidentally sent in the move horizontal number twice and have misnamed the FixedUpdate method. Make those changes and let me know if you see a difference!
edited for accuracy
Cameron Button
1,084 PointsCameron Button
1,084 PointsSo I made the changes and the frog moves now, but he only moves forward. Is that correct at this stage?
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherCameron Button that depends entirely on where you are! And unfortunately, you haven't said explicitly. However, if you are at the end of this video:
https://teamtreehouse.com/library/how-to-make-a-video-game/player-input-and-cameras/move-the-player-with-animation
Then yes! Your frog should jump forward and off the screen, but nothing else will happen. Nick explains why at 12:32 in the video
Cameron Button
1,084 PointsCameron Button
1,084 PointsJennifer Nordell, THANK YOU! I hadn't moved on yet because I didn't want to pile more onto an existing problem. I really appreciate the help.
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherCameron Button You're quite welcome! Glad I could help