From 06ac50db0f813a2954651600760f6ff30c6fd5d1 Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Wed, 23 Nov 2016 23:03:47 -0300 Subject: Modularize bola animation (bolaAnimation) in scripts/bola/animation.lua --- .../scripts/bola/animation.lua | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/animation.lua (limited to 'src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/animation.lua') diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/animation.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/animation.lua new file mode 100644 index 0000000..bd1e8de --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/animation.lua @@ -0,0 +1,29 @@ +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) + + frames = { + bola = require 'scripts.bola.frames' + } + + game = { + animation = function(start, frames) + if math.floor(start) > frames then + start = 1 + end + return start + end + } + + character.bola.stand.start = game.animation(character.bola.stand.start, frames.bola.stand) + character.bola.walk.start = game.animation(character.bola.walk.start, frames.bola.walk) + + transform = { + bola = require 'scripts.bola.transform' + } + +end + +return animationModule -- cgit v1.2.3-54-g00ecf