Animations "flicker" on movment

0 favourites
  • 7 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • What this does is to set up a system for me to gauge the movement of my main character, Buster... Is he moving up, down, left, or right? And then to compare whether his horizontal movement is greater than or less than his vertical movement.

    From there, I determine which visual animation to play, and/or whether or not to mirror the image. (I know someone will ask why I don't just set the animation to play based on what keyboard keys I press...and I had a specific reason but right now it's completely escaping my mind.)

    What I have noticed, however, is when Buster is "pushing" against a wall while going to the left or up his body doesn't appear to be "flickering" between animations. But going in either of the other two directions will show his body rapidly alternating between two animations. For instance, if Buster is moving to the right against a wall, it looks as if he is switching between left and right animations. (This doesn't happen, though, when moving against a wall immediately to his left while going to the left.)

    I suspect it has to do with the BusterBody object being "pushed back" when it briefly overlaps the wall (which has the Solid behavior). So for a brief tick, Buster is moving in the opposite direction than what the player is moving him in. The question, though, is why this only happens for two of the four directions?

    .c3p file:

  • *bump*

  • blackhornet - Might I get your insight, please?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's a precision issue. That's the problem with working with floating point numbers. I quickly added this, to reduce the precision, and it worked:

  • Aaaah! That seems to coincide with what I noticed in the debugger. I just couldn't make heads or tails of it. Thank you, again! I'll plug this in later and see that I get the same results.

  • I plugged in the actions as you have in your update and it definitely worked as promised. Tests did result in very minor occurrences of the problem while continuing to hold a direction into a wall. I also repeatedly pushed the direction into a wall while already up against it but there didn't seem to be any rhyme or reason as to exactly what triggers the brief about-face.

    However, the problem seems 99% resolved and hopefully doesn't prove to be any kind of significant issue...

    Thanks again!

  • You can tighten it up by using 10, instead of 100.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)