Difference between revisions of "dt"

m
(Add an example)
Line 1: Line 1:
 
dt is the most common shorthand for delta-time, which is usually passed through [[love.update]] to represent the amount of time which has passed since it was last called. It is in seconds, but because of the speed of modern processors is usually smaller than 1 (values like 0.01 is common).
 
dt is the most common shorthand for delta-time, which is usually passed through [[love.update]] to represent the amount of time which has passed since it was last called. It is in seconds, but because of the speed of modern processors is usually smaller than 1 (values like 0.01 is common).
 +
 +
== Examples ==
 +
 +
=== Increase a variable x by 1 every second ===
 +
<source lang="lua">
 +
x = 0
 +
love.update(dt)
 +
  x = x + dt
 +
end
 +
</source>
  
 
== See Also ==
 
== See Also ==

Revision as of 15:12, 28 July 2011

dt is the most common shorthand for delta-time, which is usually passed through love.update to represent the amount of time which has passed since it was last called. It is in seconds, but because of the speed of modern processors is usually smaller than 1 (values like 0.01 is common).

Examples

Increase a variable x by 1 every second

x = 0
love.update(dt)
   x = x + dt
end

See Also