How can I play an animation only once

  • It's a recurent problem, that I have. When I play an animation on a "tap" or a "click", often this animation is played many times consecutively.

    I always verified, the "loop button" isn't checked.

    Is someone can help me please.

  • As on tap is a trigger once, then I guess the only issue could be 'repeat count' is set to more than 1. If it's not that then let's see a screenshot of the events :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When I click or Tap on "blockGold", it plays "blockFxSpark" on layer 2.

    It works nicely, except it plays the animations more than once.

    As you can see, the animation isn't looped. ^^

  • I found something interesting. If I click on my object and maintain the click, it works perfectly. But if I only click quickly once it plays the animation more than once.

    I specify that the animation is not played on the released.

  • On the gif below you can see I click 3 times on the stone block. My animation works perfectly because I maintain the click.

    After this 3 times, I still click 3 times. And you can see the animation is played more than once each time.

    https://gph.is/2Ssovcx

  • Well it's in French but from what I can decipher you are making an object visible, not asking it to play an animation?

  • Ah sorry... I refreshed the screeenshot, here is an english version now. ^^

    Yes, when the player taps on the gold block, I spawn "blockFxSpark" over it. And I would it plays its default animation once. And it does it a bit. ^^

    It's not a good practice? How should I do?

  • Try adding trigger once while true.

  • Ok, youre answer, helped me a lot. I found a solution.

    Now, when I create "blockFxSpark", it plays an animation with only one frame. This frame is void.

    When its created, its boolean "isActive" become "true"

    When this boolean is true, "blockFxSpark" plays its animation.

    And when the animation is finished, I kill "blockFxSpark" and the boolean switch to false.

    So now I only have one occurrence of this animation because I kill it. And its probably best like that. ^^

    Thanks for youre help.

    Here it's a screenshot for helping others. ^^

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