RedditPP Mascot

RedditPP

r/Unity3D • … • u/JustLudvik

Help me plz

Hi I'm following the brackeys 2D movement in unity tutorial [https://www.youtube.com/watch?v=dwcT-Dch0bA](https://www.youtube.com/watch?v=dwcT-Dch0bA)

I've finished the entire thing and everything is working except the character moving horizontally if I hold down A or D it just looks in a diffirent direction does anyone have a soulotion.

​

Here is my code copied from the tutorial.

using System.Collections; using System.Collections.Generic; using UnityEngine; public class Playermovementscript : MonoBehaviour {

public CharacterController2D controller; public float runSpeed = 40f; float horizontalMove = 0f; bool jump = false; bool crouch = false; // Start is called before the first frame update void Start() {

} // Update is called once per frame void Update() { horizontalMove = Input.GetAxisRaw("Horizontal"); if (Input.GetButtonDown("Jump")) { jump = true; } if (Input.GetButtonDown("Crouch")) { crouch = true; }  else if (Input.GetButtonUp("Crouch")) { crouch = false; }

} void FixedUpdate () { // Move our character controller.Move(horizontalMove \* Time.fixedDeltaTime, crouch, jump); jump = false; } }

— 0