Finishing Update Animation Event
Now that our function is complete, we will call it as part of our Update Animation Event and finish off the remaining script.
On the Event Graph in the My Blueprint window, choose to Show Inherited Variables then hold Ctrl and drag in your Sprite.
Drag in the Anim State Machine function and connect it to the Set Is Moving? node, then off your Sprite add a Set Flipbook node.
Connect all of your nodes together for the UpdateAnimation custom event as shown below.
Following the Add Movement Input node from your MoveForward Event, call the Update Animation custom event.
Compile and Save then play in the editor.
You will now have a character that cycles between the two states based on your condition of whether or not the character is moving.
As mentioned, in order to add additional animation states to this setup you would need to:
Have Flipbook Animations for each of the animation states you want your character to enter.
Add and set them as Flipbook variables inside your Paper 2D Character Blueprint.
Add each of the states to the Animation State Enumeration we created.
Create conditions that determine when the character can enter each state and add it to the Anim State Machine function.
Connect each of your Flipbook variables to the Select node inside the Anim State Machine function.