diff options
author | Jorge Lopez Seijas <jorginho@riseup.net> | 2016-11-28 21:49:30 +0100 |
---|---|---|
committer | Jorge Lopez Seijas <jorginho@riseup.net> | 2016-11-28 21:49:30 +0100 |
commit | db958d7956ec40a9a837a115a69b8ce119cf42de (patch) | |
tree | b698ce1893fdc26ac1d5a398e44fcbc162ade4f3 | |
parent | 2e22d0930af0ff265afcee557e9c2ac1f8f1d354 (diff) |
Fix jump continuous press button a
3 files changed, 10 insertions, 3 deletions
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/gravity.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/gravity.lua index 98ba985..d023bed 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/gravity.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/gravity.lua @@ -14,6 +14,7 @@ function gravity(dt) character.bola.jump.velocity = 0 character.bola.position.y = character.bola.jump.ground character.bola.jump.higher = character.bola.jump.higherMax + character.bola.jump.finishJump = true end end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/jump.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/jump.lua index 42c1868..fe6646b 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/jump.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/jump.lua @@ -7,4 +7,5 @@ return { ground = windowProfile.mode.height / 2, higher = 0.15, higherMax = 0.15, + finishJump = false, } 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 e0d5465..109b873 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 @@ -3,7 +3,10 @@ local motionModule = {} function motionModule.motion(dt) if character.bola.jump.higher > 0 and love.keyboard.isScancodeDown(button.a) then jump(dt) + else + character.bola.jump.finishJump = false end + if love.keyboard.isScancodeDown(button.left) then walkLeft(dt) elseif love.keyboard.isScancodeDown(button.right) then @@ -17,10 +20,12 @@ function motionModule.motion(dt) end 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) + if character.bola.jump.finishJump == false then + 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)] + -- quad.bola = character.bola.jump[math.floor(character.bola.jump.start)] + end end function walkLeft(dt) |