Created
January 21, 2018 23:51
-
-
Save sponge/dbf30b5a2e8cacf19fc78147f7abe402 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- UPDATE | |
-- | |
local accum = 0 | |
function Game:update(dt) | |
accum = accum + dt | |
if (accum < 1/60) then | |
return | |
end | |
-- just skip frames if we slow down (window dragging) | |
while (accum > 1/60) do | |
accum = accum - 1/60 | |
end | |
dt = 1/60 | |
self.controls:update() | |
self.timer = self.timer + dt | |
self.levelTimer = self.levelTimer + dt | |
if self.controls:pressed('pause') then | |
self:togglePause() | |
end | |
if not self.paused then | |
self:updateEntities(dt) | |
end | |
self:removeEntities() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment