How do I disable trigger while waiting for timer to reach 0?

  • I'm building an upgrade-type game, where players can purchase upgrades for currency.

    My predicament is that when the player clicks the sprite to trigger the upgrade, they can click it again and reset the timer. What I'd like to accomplish is this: disable the sprite (that triggers the upgrade) until the remainder reaches 0. I'm currently using rex_timer and timeline for the timer feature.

    Furthermore, I'm having a bit of an issue where the player can be charged more than once for the upgrade WHILE the timer is counting down. What I'd like to accomplish is this: require that the player have >= 10 coins to purchase 1 upgrade. Any less than the required amount of coins, also disables the sprite (that triggers the upgrade) until the player has the required amount of coins.

    EDIT: Plinkie's suggestion regarding creating a variable and changing its value depending on the state of the script, should work (in theory). I believe that implementing this suggestion will also solve the problem with being charged more than once for a single upgrade.

    Any help is GREATLY appreciated, and I thank you in advance.

  • https://www.scirra.com/tutorials/1056/c ... eating-one

    try this one bro <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

  • Thank you, clarkkentnicdao. However, I currently have a fully-functioning countdown timer using rex's tools. What I'm having an issue with is preventing the player from resetting the timer while it is counting down.

  • Something along the lines of :

    On sprite clicked, if variable = 1, do upgrade, start timer.

    On timer started, set variable = 0 (locks out the above)

    On timer ended, set variable = 1.

  • Thank you, Plinkie, I'm currently at work and on mobile but as soon as I return home, I'll try that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here it is in all of its wonderful, working, glory!

    The CPU upgrader has the fix implemented, the Spam example still contains the bug (quite literally).

    https://www.scirra.com/arcade/other-gam ... ject-15202

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