update.lua 781 B

123456789101112131415161718192021222324252627
  1. return {
  2. tag = 'callbacks',
  3. summary = 'Called every frame to update the application logic.',
  4. description = [[
  5. The `lovr.update` callback should be used to update your game's logic. It receives a single
  6. parameter, `dt`, which represents the amount of elapsed time between frames. You can use this
  7. value to scale timers, physics, and animations in your game so they play at a smooth, consistent
  8. speed.
  9. ]],
  10. arguments = {
  11. {
  12. name = 'dt',
  13. type = 'number',
  14. description = 'The number of seconds elapsed since the last update.'
  15. }
  16. },
  17. returns = {},
  18. example = [[
  19. function lovr.update(dt)
  20. ball.vy = ball.vy + ball.gravity * dt
  21. ball.y = ball.y + ball.vy * dt
  22. end
  23. ]],
  24. related = {
  25. 'lovr.timer.getDelta'
  26. }
  27. }