How do I stop an animation while another one is playing?

0 favourites
From the Asset Store
This Student Workbook uses both Construct 3 & 2 encoding. It supplies client-side & php "back-end" encoding.
  • Hello all, I was wondering, how do I stop an animation while another one is already playing? For example, in my code below, when the player releases any of the buttons, the animation will revert back to "shoot" (which is what I want), but, how do I make an exception saying that if the 'Character' collides with a specific object, it will play "characterStarAnim" (another character animation) instead of automatically reverting back to the "shoot" animation?

    Thanks,

    guannstar (FNORD)

  • Hello,

    Perhaps adding the "Character > On collision with spellBook" beneath Touch > On any touch end as a sub event and adding an else (else to the Character on collision with spellBook) to run the shoot.

    It would look like this:

    Touch > On any touch end

    .... Charachter > On collision with spellBook -- Destroy and Set animation to "characterStarAnim"

    .... Else -- -- Set animation to "shoot"

    I think that should do the trick for you.

    Hope that helps.

  • OK, I'll try that and get back to you. Thanks a lot for the help:)

  • OK, hey Vallar, I tried what you said, but it's still not working. As you can see below, the sub-event will not allow any object ("Character") to collide with another object ("spellBook"). Instead, I had to use 'Is overlapping', and now it wont work at all. How do I get it so that it's ("Character") able to collide with other objects?

  • I think it might be that the On Touch end still has an action. I believe if you delete that it might work. Is it possible that you try with deleting the action next to Touch > On any touch end + changing back to collision rather than overlapping?

    If not, the next best thing I could think of is the original setup you had; but instead of doing it exactly the same, I would add another condition to the "Collision" which is "On touch end" if that is what you want (that the animation would play when the touch end and the character collides with that spellBook).

  • Hey Vallar, I've tried both of those solution, but none of them have worked:( I don't get it, this seems like such a simple problem, but apparently, it's not lol. I've converted my code back to the way it originally was (in my first post). Can somebody please help me out with this? ...Thanks.

  • Hello all, I was wondering, how do I stop an animation while another one is already playing? For example, in my code below, when the player releases any of the buttons, the animation will revert back to "shoot" (which is what I want), but, how do I make an exception saying that if the 'Character' collides with a specific object, it will play "characterStarAnim" (another character animation) instead of automatically reverting back to the "shoot" animation?

    Thanks,

    guannstar (FNORD)

    Add an other condition to the event with the "on any touch end":

    • animation characterStarAnim is not playing (invert the is playing).

    That will hopefully prevent the "shoot" animation to trigger while the "characterStarAnim " is playing.

  • Hey It only allows you to do 'Is playing'. How do you invert the 'is playing' when adding another condition?

  • Hey guys, sorry, I really need some help here:( Can somebody please help me?

  • Bump:(

  • To invert a condition you just need to right lick it and select invert.

    Another easy way would be to give your character object an 'instance variable' or 'Boolean' called colliding.

    In your collision event set the Boolean to true or the variable to 1, then use the timer object to revert it back to normal when your animation is due to finish. Then just add another condition to your 'on any touch end' event that makes sure that the Boolean is false or variable is set to 0 before it sets the animation.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can invert most of the conditions by right clicking on them and choose "invert" from the drop down menu. You should see a red cross-hashed "equals" symbol.

    e.g.

  • Oh... I was to slow

  • Hahaha... thanks a lot guys, that did the trick. It works now:)

  • To invert an event, you right click the event and choose "Invert condition" or "Invert Event"

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