summaryrefslogtreecommitdiff
path: root/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/animation.lua
diff options
context:
space:
mode:
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.lua34
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