diff options
Diffstat (limited to 'src/gnu_and_bola_-_the_libre_beat_em_up_game')
-rw-r--r-- | src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua | 27 | ||||
-rw-r--r-- | src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/animation.lua | 29 |
2 files changed, 32 insertions, 24 deletions
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua index e47c5dd..9da062d 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua @@ -26,7 +26,8 @@ function love.load() bola = require 'scripts.bola.bola' } - bolaMotion= require 'scripts.bola.motion' + bolaAnimation = require 'scripts.bola.animation' + bolaMotion = require 'scripts.bola.motion' end function love.keypressed(key) @@ -38,29 +39,7 @@ end function love.update(dt) nextTime = nextTime + (1 / fps) - 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' - } - + bolaAnimation.animation(dt) bolaMotion.motion(dt) end 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 |