diff options
author | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2016-12-03 17:27:36 -0300 |
---|---|---|
committer | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2016-12-03 17:27:36 -0300 |
commit | 1a9e17acb3a65a98305d19363f6b4e7185356c74 (patch) | |
tree | 99f452f72c7ca1f585e383063466513bce6e41fc /src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/animation.lua | |
parent | cc5000abb51b03dbba8ac05ece193d5f197fcf71 (diff) |
Keep the code more KISS - part 1
Diffstat (limited to 'src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/animation.lua')
-rw-r--r-- | src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/animation.lua | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/animation.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/animation.lua new file mode 100644 index 0000000..4f6688f --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/animation.lua @@ -0,0 +1,34 @@ +local animationModule = {} + +function animationModule.animation(dt) + game = {} + game.animation = function(metaSprites) + metaSprites.elapsedTime = metaSprites.elapsedTime + dt + if metaSprites.elapsedTime > (1 / metaSprites.fps) then +--[[ if metaSprites.loop > 0 then + if loopCounter == nil then + metaSprites.currentFrame = 1 + loopCounter = 1 + elseif loopCounter < loop then + metaSprites.currentFrame = 1 + loopCounter = loopCounter + 1 + else + metaSprites.currentFrame = # metaSprites + end + elseif metaSprites.loop == 0 or metaSprites.loop == false then + metaSprites.currentFrame = # metaSprites + elseif metaSprites.loop == -1 or metaSprites.loop == true then + metaSprites.currentFrame = 1 + end +]] + if metaSprites.currentFrame < # metaSprites then + metaSprites.currentFrame = metaSprites.currentFrame + 1 + else + metaSprites.currentFrame = 1 + end + metaSprites.elapsedTime = 0 + end + end +end + +return animationModule |