Making "Every X Seconds" stop

Get help using Construct 2

Post » Sun Aug 05, 2012 3:43 am

Hi Guys
I have a game where I send a ping back to a server using AJAX every 10 seconds.
When the game is not running, I dont want this to happen. I'm using the visibility of the "Start Game" button to check this.
Once the "Every 10 Seconds" is triggered, how do I stop it once the game is over?
This is the Event

http://imgur.com/hzAyc

Is the condition that the textStartGame is not visible only required to start the Every X Seconds timer, or is it checked each time the timer is run? How do I stop the timer?

Cheers

Lucas
B
16
S
1
Posts: 6
Reputation: 1,363

Post » Sun Aug 05, 2012 5:27 am

You just need to add another condition. For example, check to see if a global variable "pinging" equals 1

and when you don't want it to ping just set "pinging" to 0

alternatively, you could just disable the group that it's in.

The text visibility will be checked on every single tick.. and moving on to the next condition it will then check to see if ten seconds have elapsed since the first time the action/ping happened. If so it will ping again.
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Sun Aug 05, 2012 6:28 am

Do as keepee suggested, put it in a group, and disable the group :)
B
36
S
10
G
6
Posts: 948
Reputation: 11,101

Post » Fri Aug 10, 2012 2:36 am

Thanks guys
B
16
S
1
Posts: 6
Reputation: 1,363


Return to How do I....?

Who is online

Users browsing this forum: selaus, Yahoo [Bot] and 0 guests