Phaser time

Recommended Posts

dear friends,

I don't understand the  2 lines of code below.  please help me

if ( > shootTime)


nut = nuts.getFirstExists(false);



Share this post

Link to post
Share on other sites

If you're using Phaser time then it will probably be (never used it myself so I might be wrong) a certain increasing value that can be used to measure how much time elapsed since a certain event. You don't really care about the initial value - all you need to know it's displayed in milliseconds and it increments accordingly.

So at a certain point in your code you could say:

var shootTime =; 

Later in code you could check if a certain amount if time elapsed like this (checks if 1000 milliseconds have passed and does something):

var mSeconds = 1000;

if( > (shootTime + mSeconds)){

//do stuff



var shootTime = + 1000;//stores the current time + 1000 milliseconds

if( > shootTime){

//do something



Like I said, you took those two lines out of the context so I can't really be sure to what those variables are pointing. 

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.