diff options
Diffstat (limited to 'src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/animation.lua')
-rw-r--r-- | src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/animation.lua | 21 |
1 files changed, 13 insertions, 8 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 e3c714e..fb7fddd 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 @@ -12,7 +12,12 @@ function animationModule.animation(dt) } game = { - animation = function(start, frames, loop) + animation = function(start, frames, loop, restart) + if restart == true then + start = start - start + 1 + elseif restart == false or restart == nil then + start = start + end if math.floor(start) > frames then if loop > 0 then if loopCounter == nil then @@ -24,9 +29,9 @@ function animationModule.animation(dt) else start = frames end - elseif loop == 0 then + elseif loop == 0 or loop == false then start = frames - elseif loop == -1 or loop == nil then + elseif loop == -1 or loop == true or loop == nil then start = 1 end end @@ -34,11 +39,11 @@ function animationModule.animation(dt) end } - 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.crouchDown.start = game.animation(character.bola.crouchDown.start, frames.bola.crouchDown, 0) - character.bola.crouch.start = game.animation(character.bola.crouch.start, frames.bola.crouch, -1) - character.bola.standUp.start = game.animation(character.bola.standUp.start, frames.bola.standUp, 0) + character.bola.stand.start = game.animation(character.bola.stand.start, frames.bola.stand, -1, false) + character.bola.walk.start = game.animation(character.bola.walk.start, frames.bola.walk, -1, false) + character.bola.crouchDown.start = game.animation(character.bola.crouchDown.start, frames.bola.crouchDown, 0, false) + character.bola.crouch.start = game.animation(character.bola.crouch.start, frames.bola.crouch, -1, false) + character.bola.standUp.start = game.animation(character.bola.standUp.start, frames.bola.standUp, 0, false) transform = { bola = { |