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

Get help using Construct 2

Post » Mon Feb 06, 2017 6:25 am

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. :D
Last edited by lesjake on Mon Feb 06, 2017 1:16 pm, edited 1 time in total.
B
6
S
2
G
1
Posts: 4
Reputation: 958

Post » Mon Feb 06, 2017 8:17 am

B
79
S
31
G
7
Posts: 148
Reputation: 9,179

Post » Mon Feb 06, 2017 12:53 pm

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.
B
6
S
2
G
1
Posts: 4
Reputation: 958

Post » Mon Feb 06, 2017 1:05 pm

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.
B
45
S
15
G
73
Posts: 2,002
Reputation: 43,386

Post » Mon Feb 06, 2017 1:08 pm

Thank you, Plinkie, I'm currently at work and on mobile but as soon as I return home, I'll try that.
B
6
S
2
G
1
Posts: 4
Reputation: 958

Post » Tue Feb 07, 2017 1:01 am

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
B
6
S
2
G
1
Posts: 4
Reputation: 958


Return to How do I....?

Who is online

Users browsing this forum: zsoldiers and 11 guests