Making "Every X Seconds" stop

0 favourites
  • 4 posts
From the Asset Store
Make your own platformer for both the web and mobile easy with this Santas Platformer Template, FULLY DOCUMENTED
  • 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

  • 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.

  • Do as keepee suggested, put it in a group, and disable the group :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks guys

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