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/scripts/bola/animation.lua | 28 |
1 files changed, 22 insertions, 6 deletions
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 index a370744..0986487 100644 --- 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 @@ -1,24 +1,40 @@ 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.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.crouch.start = character.bola.crouch.start + (dt * character.bola.crouch.fps) frames = { bola = require 'scripts.bola.frames' } game = { - animation = function(start, frames) + animation = function(start, frames, loop) if math.floor(start) > frames then - start = 1 + if loop > 0 then + if loopNumber == nil then + start = 1 + loopNumber = 1 + elseif loopNumber < loop then + start = 1 + loopNumber = loopNumber + 1 + else + start = frames + end + elseif loop == 0 then + start = frames + elseif loop == -1 or loop == nil then + start = 1 + end 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) + character.bola.stand.start = game.animation(character.bola.stand.start, frames.bola.stand, -1) + character.bola.walk.start = game.animation(character.bola.walk.start, frames.bola.walk, -1) +-- character.bola.crouch.start = game.animation(character.bola.crouch.start, frames.bola.crouch, -1) transform = { bola = { |