1
\$\begingroup\$

In Java slick2d , i started printing out Delta which is supposed to be the time and it prints out is 16 or 17 forever, so how does this help me if i want to tell an object when it needs to do something, example : IF (createdtime + 60miliseconds < delta )

60miliseconds after its creation , do something

\$\endgroup\$
3
\$\begingroup\$

Delta time is the amount of time since the last update. You're getting 16 or 17 because it has been 16 or 17 milliseconds since the last update. If you want to know how long your game has been running, do something like:

long runningTime = 0; //declared outside the update loop


//in update loop put:

runningTime += deltaTime;

if(runningTime > 60)
    //do something every frame after 60 milliseconds.
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.