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.

https://www.dropbox.com/s/1ok7zzl4kwnb5n2/caves%20of%20auld.capx?dl=0 Here's a link to the .capx
B
5
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
    etc.
Image
B
10
S
3
G
2
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!
B
5
Posts: 36
Reputation: 397


Return to How do I....?

Who is online

Users browsing this forum: danul777 and 2 guests