Strange Animation Issue

Get help using Construct 2

Post » Thu Apr 18, 2013 7:13 pm

This code makes it so the bandit does an attack animation when you are within 100 pixels from it. The first time the attack animation occurs, it works, but the second time the attack animation occurs, the first frame is drawn out by 4-5 times its length. After the second time, the animations works as expected continuously.

Can anyone see anything I'm doing wrong here?



I have an event below that you cannot see that basically says if bandit is Attacking, Set Animation to "Attack". Below that I have On Animation "Attack" finished, Set Attacking to false and Chasing to true.

Any help would be greatly appreciated. Thanks!
B
22
S
3
Posts: 451
Reputation: 2,135

Post » Thu Apr 18, 2013 7:40 pm

@ome6a1717 - In the event that we can't see, do you set "attacking" to false, or something along those lines in order for the SetAnimation action to not trigger multiple times? Not sure if that would cause the problem or not, but might be worth looking at... you could also try adding a condition to that event that says if the animation is NOT already playing, and the bandit is attacking, then play the attack animation.

Not sure why it would only happen on the second time though...
B
9
S
3
G
4
Posts: 63
Reputation: 3,083

Post » Fri Apr 19, 2013 4:49 am

@rogueNoodle - I set attacking to false only at the end of the attack animation and chasing to true (so incase the player stays within 100 pixels, it "restarts" the attack animation). I've even set up a text box with every #/text variable it's affecting to make sure and everything looks fine.

I'll try the <if animation is NOT playing> tactic, but any other ideas would be greatly appreciated. I'm completely stumped on this one!

Thanks!
B
22
S
3
Posts: 451
Reputation: 2,135

Post » Fri Apr 19, 2013 7:06 am

[QUOTE=rogueNoodle] ...you could also try adding a condition to that event that says if the animation is NOT already playing, and the bandit is attacking, then play the attack animation. [/QUOTE]

Strangely enough, adding this line makes it so on the 2nd time the bandit attacks, it stays stuck on the 1st frame until I hit the bandit (which resets the attack/chase parameters)
B
22
S
3
Posts: 451
Reputation: 2,135

Post » Sat Apr 20, 2013 7:12 pm

Sorry to rebump this - but I still haven't been able to figure this out. Disabling the entire ELSE event tree doesn't seem to fix anything, either. If I set to play an animation while an instance variable is true, will it mess up because it's trying to loop?

Also, the instance variable is found in the family of the object - that shouldn't make a difference; right?
B
22
S
3
Posts: 451
Reputation: 2,135


Return to How do I....?

Who is online

Users browsing this forum: DemantDigitalArt and 21 guests