local animationModule = {} function animationModule.animation(dt) character.bola.stand.start = character.bola.stand.start + (dt * character.bola.stand.fps) character.bola.walk.start = character.bola.walk.start + (dt * character.bola.walk.fps) character.bola.jump.start = character.bola.jump.start + (dt * character.bola.jump.fps) frames = { bola = require 'scripts.bola.frames' } game = { animation = function(start, frames, loop, restart) --[[if restart == true then start = start - start + 1 elseif restart == false or restart == nil then start = start end--]] if restart == true then start = 1 end if math.floor(start) > frames then if loop > 0 then if loopCounter == nil then start = 1 loopCounter = 1 elseif loopCounter < loop then start = 1 loopCounter = loopCounter + 1 else start = frames end elseif loop == 0 or loop == false then start = frames elseif loop == -1 or loop == true or loop == nil then start = 1 end end return start end } character.bola.stand.start = game.animation(character.bola.stand.start, frames.bola.stand, -1, false) character.bola.walk.start = game.animation(character.bola.walk.start, frames.bola.walk, -1, false) character.bola.jump.start = game.animation(character.bola.jump.start, frames.bola.jump, -1, false) quad = { bola = character.bola.stand[math.floor(character.bola.stand.start)] } end return animationModule