Strange Animation Issue

0 favourites
  • 5 posts
From the Asset Store
Strange factory themed set of tiles for your platformer game
  • 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?

    <img src="http://stevemazzaro.com/OM6A/Scirra/BanditAnimation.PNG" border="0" />

    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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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...

  • 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!

  • ...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.

    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)

  • 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?

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