Skip to content

Instantly share code, notes, and snippets.

@arch-jslin
Created May 31, 2011 15:21
Show Gist options
  • Save arch-jslin/1000683 to your computer and use it in GitHub Desktop.
Save arch-jslin/1000683 to your computer and use it in GitHub Desktop.
just blah
function Game:process_dropping(now_t, last_t)
self.cubes:for2d(function(c)
if c:is_waiting() then
if self:is_below_empty(c) then
drop_cube_logical(c, self.cubes)
drop_cube(c, now_t, last_t)
end
elseif c:is_dropping() then
drop_cube(c, now_t, last_t)
if c:arrived_at_logical_position() then
if self:is_below_empty(c) then
drop_cube_logical(c, self.cubes)
else
stop_cube_logical(c)
stop_cube(c)
end
end
end
end)
end
function Game:cycle_event()
if not self.cycle_event_ then
self.last_t = system.getTimer() -- not os.clock() here
self.cycle_event_ = function(event)
self:process_dropping(event.time, self.last_t)
self:process_chaining()
self.last_t = event.time
end
end
return self.cycle_event_
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment