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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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