Modifying multiplying calculation to use delta time

Posted by Bart van Heukelom on Stack Overflow See other posts from Stack Overflow or by Bart van Heukelom
Published on 2010-04-19T09:10:57Z Indexed on 2010/04/19 9:13 UTC
Read the original article Hit count: 292

function(deltaTime) {
  x = x * 0.9;
}

This function is called in a game loop. First assume that it's running at a constant 30 FPS, so deltaTime is always 1/30.

Now the game is changed so deltaTime isn't always 1/30 but becomes variable. How can I incorporate deltaTime in the calculation of x to keep the "effect per second" the same?

© Stack Overflow or respective owner

Related posts about math

Related posts about game-development