diff options
author | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2016-11-24 05:38:07 -0300 |
---|---|---|
committer | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2016-11-24 11:31:56 -0300 |
commit | 6fd92054f1e06ba8d10060ce0e980d0ba8b57ee1 (patch) | |
tree | a960fea580333288d0120b057fdd643c2bbea69a /src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/animation.lua | |
parent | 7c0b99d56d0f25cd22f9914f0a17fcf581fb945d (diff) |
Minor fix in origin.{crouchDown,standUp}, Add crouchDown/standUp(), replace love.keyboard.isDown to love.keyboard.isScancodeDown and add restart on game.animation()
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 = { |