2d game/ unexpected idle flicker when landing (to run)
Hello world, first post here ("cough" of many).
Probably a simple fix here and try not to judge, new to Unity and C# (cries of "oh no not another") be gentle.
To the meat and tato's shal I? ok doke. I have set up my whole animation and scripted the playerControls etc and all looks promising , the issue is is that it runs good and falls from running if the y < 0. Idles well 0_O, , , this was a big step on my journey so back off HaHa but I'll prep the turkey again,the issue is.
//real issue here > I run > jump> fall to idle perfectly (games mechanics and animation) but if I run> jump> fall> (to velocity.x > 0) ie running, before the run animation begins, I see about a frame of idle, this also happens when walking off the edge into a fall animation to continue running, I sometimes see the frame of idle wanting to see more of the game "HEY man you created me first" is what he says while popping onto my screen for that briefest of mil seconds before running with the middle finger.
to sum up, the ground tile set is layered as the IsTouchingLayers(ground) collision (no idea if this is a cause? not mathed enough in this to diagnose on my lonesome).
but yeah a single frame of idle shows between the animations of fall > run (I could have saved you the read and five cups of tea by just saying this, but hey ho I'm new and full of spunk orrr rather beans, great ideas in my head and a steam launch in the distance HaHa), one day Mr miyagi I will come strong with the chopsticks of C#.
Guys many thanks for your audience and hope to speak to you witty geniuses' soon, just don't rub your nipple while speaking to me :) off to watch South Park.
Answer by Retro-1up-Junkie · Oct 24, 2020 at 03:56 PM
Never mind I figured it out.
falling lead to (coll.IsTouchingLayers(ground)) { state = State.idle; }
changed it to (coll.IsTouchingLayers(ground) && (Mathf.Abs(rb.velocity.x) < 0.1f)) { state = State.idle }