diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/animation.lua | 22 | ||||
-rw-r--r-- | src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/motion.lua | 7 |
2 files changed, 10 insertions, 19 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 f432a5a..ce93300 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,13 @@ 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.jump.start = character.bola.jump.start + (dt * character.bola.jump.fps) - frames = { bola = require 'scripts.bola.frames' } game = { - 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 restart == true then - start = 1 - end + animation = function(start, fps, frames, loop) + start = start + (fps * dt) if math.floor(start) > frames then if loop > 0 then if loopCounter == nil then @@ -32,7 +21,7 @@ function animationModule.animation(dt) end elseif loop == 0 or loop == false then start = frames - elseif loop == -1 or loop == true or loop == nil then + elseif loop == -1 or loop == true then start = 1 end end @@ -40,10 +29,7 @@ function animationModule.animation(dt) end } - 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.jump.start = game.animation(character.bola.jump.start, frames.bola.jump, -1, false) - + character.bola.stand.start = game.animation(character.bola.stand.start, character.bola.stand.fps, frames.bola.stand, -1) quad = { bola = character.bola.stand[math.floor(character.bola.stand.start)] } diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/motion.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/motion.lua index 3b807a6..2cf232a 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/motion.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/motion.lua @@ -27,18 +27,21 @@ function jump(dt) character.bola.jump.higher = character.bola.jump.higher - dt character.bola.jump.velocity = character.bola.jump.velocity + character.bola.jump.height * (dt / character.bola.jump.higherMax) - -- quad.bola = character.bola.jump[math.floor(character.bola.jump.start)] + -- character.bola.jump.start = game.animation(character.bola.jump.start, character.bola.jump.fps, frames.bola.jump, 0) + -- quad.bola = character.bola.jump[math.floor(character.bola.jump.start)] end end function walkLeft(dt) character.bola.position.x = character.bola.position.x - (character.bola.velocity * dt) + character.bola.walk.start = game.animation(character.bola.walk.start, character.bola.walk.fps, frames.bola.walk, -1) quad.bola = character.bola.walk[math.floor(character.bola.walk.start)] character.bola.scale.x = -1 end function walkRight(dt) character.bola.position.x = character.bola.position.x + (character.bola.velocity * dt) + character.bola.walk.start = game.animation(character.bola.walk.start, character.bola.walk.fps, frames.bola.walk, -1) quad.bola = character.bola.walk[math.floor(character.bola.walk.start)] character.bola.scale.x = 1 end @@ -46,12 +49,14 @@ end function walkUp(dt) character.bola.position.y = character.bola.position.y - (character.bola.velocity * dt) character.bola.jump.ground = character.bola.position.y + character.bola.walk.start = game.animation(character.bola.walk.start, character.bola.walk.fps, frames.bola.walk, -1) quad.bola = character.bola.walk[math.floor(character.bola.walk.start)] end function walkDown(dt) character.bola.position.y = character.bola.position.y + (character.bola.velocity * dt) character.bola.jump.ground = character.bola.position.y + character.bola.walk.start = game.animation(character.bola.walk.start, character.bola.walk.fps, frames.bola.walk, -1) quad.bola = character.bola.walk[math.floor(character.bola.walk.start)] end |