Jump to content

How to put a "wait" "delay" between one action and another


dandorf
 Share

Recommended Posts

  • 3 years later...
On 6 de outubro de 2014 at 4:10 PM, nkholski said:

 



 

function shoot(){

if(nextShot>game.time.now){return;} // too early

/* make shot */

nextShot = game.time.now + 1000; // wait at least 1 second (1000ms) to next shot

}

 

There is also the  

this.game.time.events.add(TIME, function () { //DO STUFF}, self);

But I really liked this way.

 

Link to comment
Share on other sites

  • 2 years later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...