How do I disable actions on a button and then re-enable them once an animation has finished playing?

0 favourites
  • 6 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • So in my previous post, I asked for help with setting up RNG Odds that have diminishing returns on each press and have the button locked once the number hits 0. This works perfectly and I now have it assigned to a health system and an animation plays on a character whenever the button is played. However, I find the system exploitable and easily spamable. Is there a way of having the button temporarily disabled while the animation is playing and then, once finished, you can then click on the button again?

    For reference, this is what my event sheet looks like:

  • Lock it out with a global variable, on the button click condition add 'var = 0', then on the first action when you press the button set the var to 1. Then in a separate event you need 'on that animation finished' set var to 0.

  • I have tried it, but I can still spam the button to deplete my character's health. Did I do something wrong?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I tend to lock my buttons via a timer or tweens usually. On press start a timer/tween and then in the conditions check "is NOT timer/tween playing"

  • I have tried it, but I can still spam the button to deplete my character's health. Did I do something wrong?

    Yep that's wrong.

    On the button click event condition, add the condition 'var = 0' to the same event block on the left, they are called conditions.

    Where you have the first action set Anim_Lock to 0, change this to 1

    Where you have the set Anim_lock to 0 action further down next to MyUID, delete it.

    The on animation finished event should be on its own, not inside the button click.

  • oh thank you. Got it working now

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