How to implement "and" and "if" in node form?

I was wondering how do I implement conditions?

In this example I want turning animation to play if D and A are pressed but W and S are not?

The reason I am asking is because I used the following bp to make the character to play turning animation when turning but if the character is moving forward or backward and then A or D are pressed then the animation overrides the walking animation.

To make it less complicated I am trying to insert the condition that
Play turn animation ONLY when A or D are pressed and W and S are NOT.

I think the easiest way to accomplish this would be to create 4 boolean variables (isApressed, isDpressed, isWpressed and isSpressed). Set their value to true on their respective “Pressed” event, and false on their respective “Released” event. And then on both your A and D pressed event, you can check all 4 variables to see if they meet your conditions noted above.

As far as doing “IF” statements in blueprint, take a look at the “Branch” node. It accepts a boolean value and gives you a branch for True and False.

AND can be accomplished by using the “AND” node, again accepting boolean inputs.

Hope that helps point you in the right direction.

Like this? I did these but nothing changed. Sorry, I’m new to Unreal so certain aspects still confuse me greatly.

Look into [logic gates][1].


To make it less complicated I am
trying to insert the condition that
Play turn animation ONLY when A or D
are pressed and W and S are NOT.

If I wanted to execute D only when neither W or S are being pressed, I’d:

Worked like a charm! Thank you! Though there is one tiny detail remaining. I noticed if the character moves left and right while moving forward and backward and then I let go of W or S then turning animation will not play until I let go of A or D and then press them again. Any solutions for that?