diff options
author | Jorge Lopez Seijas <jorginho@riseup.net> | 2016-12-01 22:53:44 +0100 |
---|---|---|
committer | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2016-12-01 19:53:38 -0300 |
commit | 80875485a285be0f44727adfc55999c8989dec04 (patch) | |
tree | 96d6c501b0f460ada524a12904dfd7290a9c4660 /src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola | |
parent | 66076f572c2289d7522f56f864013e9a9d6d8d8d (diff) |
Add variable isJumping in jump.lua and limit up and down movement when jump
Diffstat (limited to 'src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola')
-rw-r--r-- | src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/gravity.lua | 8 | ||||
-rw-r--r-- | src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/jump.lua | 1 |
2 files changed, 9 insertions, 0 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 af8388a..a8c927a 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 @@ -6,6 +6,7 @@ end function gravity(dt) if character.bola.jump.velocity ~= 0 then + character.bola.jump.isJumping = true character.bola.position.y = character.bola.position.y + (character.bola.jump.velocity * dt) character.bola.jump.velocity = character.bola.jump.velocity - (character.bola.gravity * dt) end @@ -16,7 +17,14 @@ function gravity(dt) character.bola.jump.higher = character.bola.jump.higherMax character.bola.jump.limitButtonJump = false + character.bola.jump.isJumping = false character.bola.actionA = false + + if love.keyboard.isScancodeDown(button.up) then + character.bola.actionUp = true + elseif love.keyboard.isScancodeDown(button.down) then + character.bola.actionDown = true + end 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 d7d81b7..b69224e 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 @@ -8,4 +8,5 @@ return { higher = 0.15, higherMax = 0.15, limitButtonJump = false, + isJumping = false, } |