game.animation = function(character, dt) character.elapsedTime = character.elapsedTime + dt if character.elapsedTime > (1 / character.fps) then --[[ if character.loop > 0 then if loopCounter == nil then character.currentFrame = 1 loopCounter = 1 elseif loopCounter < loop then character.currentFrame = 1 loopCounter = loopCounter + 1 else character.currentFrame = # character end elseif character.loop == 0 or character.loop == false then character.currentFrame = # character elseif character.loop == -1 or character.loop == true then character.currentFrame = 1 end ]] if character.currentFrame < # character then character.currentFrame = character.currentFrame + 1 else character.currentFrame = 1 end character.elapsedTime = 0 end end