- Home /
Flipping Sprite based in controller input
Hello, in the code bellow i would like to convert the comented out section and somewhere in the mix implement the very first line under HandleInput().
The thing is that i indeed get horizontal movement but the character itself wont flip along with it. and thats ok for now but how to struct up the code to make it work like expected?
private void HandleInput()
{
_normalizedHorizontalSpeed = Input.GetAxisRaw("Horizontal");
// if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow)) // { // _normalizedHorizontalSpeed = 1; // // if (!_isFacingRight) // Flip(); // } // // else if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow)) // { // _normalizedHorizontalSpeed = -1; // // if (_isFacingRight) // Flip(); // } // // else // { // _normalizedHorizontalSpeed = 0; // }
Your answer
Follow this Question
Related Questions
Input.GetAxis to act like button 1 Answer
How to control an character that has sprites? 1 Answer
Changing how my character looks depending on his current lifes. 2 Answers
Character Sprite "Spasms" 0 Answers
Keeping forward transform 2 Answers