ticker=object:extend()

function ticker:new(tickTime)
self.tickTime=tickTime
self.ticks=0
self.lastTickTime=-1
end

function ticker:update(dt)
if self.lastTickTime==-1 then
return false
end
local now=love.timer.getTime()
local diff=now-self.lastTickTime
if diff>=self.tickTime then
self.lastTickTime=now+(self.tickTime-diff)
self.ticks=self.ticks+1
self:tick()
return true
end
end

function ticker:calibrate(time)
self.lastTickTime=time
self.ticks=1 -- can't be bothered to be elegant tbh
self.tick()
end

function ticker:tick()
-- do stuff here
end