summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorge Lopez Seijas <jorginho@riseup.net>2016-11-28 21:49:30 +0100
committercoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2016-11-29 17:39:24 -0300
commitb109b2bffc5e5497b248c9f43e7da93f9e1ea785 (patch)
treea4f7c182928d3525f8be37a030d6dbdb9fa3855f
parent13f8589c8879382989ef1696d72ed437805ec399 (diff)
Fix jump continuous press button a
-rw-r--r--src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/gravity.lua1
-rw-r--r--src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/jump.lua1
-rw-r--r--src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/motion.lua11
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)