Diagonal walking animation?

I don’t know how to make a diagonal walking animation for this cat. http://www.flowlab.io/game/play/1151931

well, the problem is that you physically can’t do that, a player is pressing 2 keys that have their own animations, so the way you would fix the issue would have to be by choosing which one of the 2 you think best fits, then up the priority

EDIT: now that I think about it, you would have to use the AND logic gate and make both buttons go in, make the animation, then prioritize it

I tried that but I was a little confused

make an AND logic gate, the two inputs being both the, for example, top and right keys. If both are pushed, then activate that animaton. :slight_smile:

the problem is that it also activates the other animations for when you press a and d by themselves

@Crigence has done it before, buuut…

Hi @Broseph

Well done :slight_smile:
If keen to make it less block heavy try this:

Link here: https://flowlab.io/game/play/1401064

Not perfect, but a good starting point :wink: (… yes it has its flaws …)

It is a variation of my ‘One Way’ key blocker routine, modified to output angles.
( Discussion here: http://forum.flowlab.io/discussion/8448/locked-4-way-movement#latest)

You already did most of the work, but instead of a whole series of blocks to assign the angles I used the Math.atan2() function.

It calculates the angle from a 2D vector and in your case it works because you use the same +3,-3 for left-right and up-down. That gives even multiples of 45 degree ( … the trouble starts if they are not the same, then you have to do it your way … )

P.S. @grazer … what are the chances of having a public ‘Behavior Bundles Library’. I think it would be great to have some common snippets available somewhere. The search function in this forum is not very great and sometimes the same questions show up over and over again.

I created one, but it sounds like its a bit different than what you want