How do I play an animation while crouching?

0 favourites
  • 3 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • I've run in to a problem trying to get a crouching attack to work. Standing attacks and jumping attacks work, but when crouching and attacking the animation freezes and will not play until the player jumps, at which point only the crouching attack animation will play (not the jumping animation).

    I've been banging my head against this problem for a couple of hours now and I cannot for the life of me figure this one out.

    dropbox.com/s/1ok7zzl4kwnb5n2/caves%20of%20auld.capx Here's a link to the .capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think Event 3 needs one more condition. "Is Not Crouch Attacking".

    It was freezing because Event 3 would set its animation to Idle first, and after that you'd change it back to CrouchingAttack. Since this would happen every tick, it would never get the chance to go to the next animation frame.

    These events are prone to such errors though. I would suggest trying to use more sub-events and Else conditions for neater logic. For example:

    On N Pressed
         Player Is Standing
            Do standing attack animation
         Player Is Crouching
            Do crouching attack animation
        etc.
    [/code:2vxkp847]
  • Thank you so much! I knew it would be simple but I just couldn't see it.

    I've taken your advice and adjusted my event system to use nested sub-events and it looks much cleaner and easier to read now. Thanks again!

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