Hey, making a 2d sidescroller game
I am on movement, I am getting it to where the player can rotate, but the thing is, if i include the script to rotate the character, the Horizontal input will always be positive no matter if I choose the negative input (aka “left” or “a”). So it will always move right.
Movement:
var controller : CharacterController = GetComponent(CharacterController);
if (controller.isGrounded)
{
moveDirection = Vector3(Input.GetAxis("Horizontal"), 0,0);
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
}
Turning:
if (Input.GetButton("Left"))
{
transform.eulerAngles = Vector3(0,180,0);
}
if (Input.GetButton("Right"))
{
transform.eulerAngles = Vector3(0,0,0);
}
Any help would be awesome.