SpriteRenderer FlipX too much?!
So I am very new to Game Programming and have been having a TON of fun, but recently ive been having a little bit of trouble with flipping my Sprite on the X axis using Sprite Renderer. Basically I have a code that checks if the speed is < 0, if true it will flip, otherwise false.. like this sr.flipX = rb.velocity.x < 0 ? true : false;
For a basis, I have separated my player scripts into different files, character, horizontal movement and jump; I believe the file names are all self explanatory to what type of code I have within each and I will also share the codes below.
The issue I am having is that the character is that my sprite constantly wants to reset the X. So if I move left and come to a stop it jitters to the left but eventually ends up facing to the right. Likewise, if I move to the right it will jitter to the left and eventually face to the right. https://media.giphy.com/media/4NUwqKnW9Lr0r1x5Ng/giphy.gif
The end goal was to have it face the way it was moving towards.. but so far ive bene unsuccseful. I believe it has something to do with my player movement code and the application of Delta Time but I am not familiar enough with C# to figure this one out :(. Below is all 3 files of my code in which they communicate to each other.
//Character.CS https://www.codepile.net/pile/weYy3Oe6
//Horizontal Movement.CS https://www.codepile.net/pile/EgWkykga
//Jump.CS https://www.codepile.net/pile/Qke7ROXV
Your answer
![](https://koobas.hobune.stream/wayback/20220613033506im_/https://answers.unity.com/themes/thub/images/avi.jpg)