diff options
Diffstat (limited to 'src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/motion.lua')
-rw-r--r-- | src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/motion.lua | 25 |
1 files changed, 19 insertions, 6 deletions
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 89d3832..e0d5465 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 @@ -9,6 +9,11 @@ function motionModule.motion(dt) elseif love.keyboard.isScancodeDown(button.right) then walkRight(dt) end + if love.keyboard.isScancodeDown(button.up) then + walkUp(dt) + elseif love.keyboard.isScancodeDown(button.down) then + walkDown(dt) + end end function jump(dt) @@ -19,19 +24,27 @@ function jump(dt) end function walkLeft(dt) - if character.bola.position.x >= character.bola.origin.x then - character.bola.position.x = character.bola.position.x - (character.bola.velocity * dt) - end + character.bola.position.x = character.bola.position.x - (character.bola.velocity * dt) quad.bola = character.bola.walk[math.floor(character.bola.walk.start)] character.bola.scale.x = -1 end function walkRight(dt) - if character.bola.position.x <= windowProfile.mode.width - character.bola.origin.x then - character.bola.position.x = character.bola.position.x + (character.bola.velocity * dt) - end + character.bola.position.x = character.bola.position.x + (character.bola.velocity * dt) quad.bola = character.bola.walk[math.floor(character.bola.walk.start)] character.bola.scale.x = 1 end +function walkUp(dt) + character.bola.position.y = character.bola.position.y - (character.bola.velocity * dt) + character.bola.jump.ground = character.bola.position.y + 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 + quad.bola = character.bola.walk[math.floor(character.bola.walk.start)] +end + return motionModule |