How do I play an animation while crouching?

Get help using Construct 2

Post » Sat Apr 11, 2015 8:15 am

Message: arrjayjee can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
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. Here's a link to the .capx
Posts: 36
Reputation: 397

Post » Sat Apr 11, 2015 9:17 am

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:

Code: Select all
On N Pressed
     Player Is Standing
        Do standing attack animation
     Player Is Crouching
        Do crouching attack animation
Posts: 196
Reputation: 2,053

Post » Sat Apr 11, 2015 9:26 am

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!
Posts: 36
Reputation: 397

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests