- Home /
Question by
Bunnehop0923 · Feb 17, 2021 at 01:30 PM ·
flip
can't find a way to flip player based on which key is being pressed
I've been trying to find a way to flip my player when the left or right key is pressed I've looked at several tutorials none of them work I've look through some of the other post that had this same question still nothing worked pls help
Comment
Answer by logicandchaos · Feb 17, 2021 at 03:10 PM
SpriteRenderer sr;
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
sr.flipX = true;
}
if (Input.GetKeyDown(KeyCode.RightArrow))
{
sr.flipX = false;
}
Your answer

Follow this Question
Related Questions
duplicate and flip mesh in code 5 Answers
Seeing through mesh 1 Answer
Flipping a 2D Sprite in Javascript 0 Answers
camera rotating with player 2 Answers
Making an unflipable rigidbody without freezing rotation 0 Answers