https://imgur.com/a/xLzxlGB

I'm currently trying to make a top-down 2d game with eight-directional sprite movement and I'm having some difficulties with the animation. Currently it moves, but when I try to change direction it jitters back-and-forth between the previous and new direction, until I stop pressing the keys and then it faces the new direction. I suppose I'm wondering if the problem is in the schematic, or if it's somewhere else? I've made the animations work in a different project with a script and the schematic is trying to approximate that.
Post edited by pseudoscience on
  • Is only the animation jittering or also the movement going back and forth?
    Hard to tell without seeing the details of the nodes - my first guess would be some variable that's used by animation (or movement, if that's also affected) not being set correctly.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • That is a good question, I mostly have it on a blue background so far. I should also import a tile map and see.

    The animation controller takes in the InputKeyAxis values, sets them as InputX and InputY parameters and chooses the direction and animation based on that. It's also intended to use the last input and use that to choose the facing direction in the idle state, which I originally did because the sprite kept snapping back to facing south by default. (the lastX, lastinput values).


    If I set the parameters in a separate node before playing the animation I have the same problem.

    Sorry for not getting back to this, I've been trying to determine the problem, which I think is the idle state. If I remove the connection to the Play Idle node, the sprite keeps moving without stopping, but the animation's not jittery anymore. So the problem has to do with the Idle state.

  • I just figured it out, you were right, one of the values wasn't being set. I had neglected to set the "idle" boolean to false when the sprite is supposed to move, everything works now. Thanks for the help.
  • Great, let me know if you run into any more issues :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.