Callback
update( dt )
This function should update the state of the game according to the time value dt.
Synopsis
function update( dt ) ... end
Arguments
dt The time since last update in seconds.
Returns
(Nothing)
Examples
Example 51: Basic callbacks
  1. -- Example: Basic callbacks 
  2.  
  3. elapsed = 0 
  4.  
  5. -- Load: called when the game 
  6. -- loads. 
  7. function load() 
  8.     -- Load a font 
  9.     local f = love.graphics.newFont(love.default_font, 12
  10.     love.graphics.setFont(f) 
  11. end 
  12.  
  13. -- Update: Called each frame. Update the 
  14. -- state of your game here. 
  15. function update(dt) 
  16.     elapsed = elapsed + dt 
  17. end 
  18.  
  19. -- Draw: Called each frame. The game 
  20. -- should be drawn in this functions. 
  21. function draw() 
  22.     love.graphics.draw("Elapsed time: " .. elapsed, 100100
  23. end 
Copyright © 2006-2008 LÖVE Development Team.