diff options
Diffstat (limited to 'src')
3 files changed, 66 insertions, 7 deletions
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua index 3afcce6..409028d 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua @@ -22,10 +22,58 @@ function love.load() bolaLimit = require 'scripts.bola.limit' end -function love.keypressed(key) - if key == button.quit then +function love.keypressed(key, scancode, isrepeat) + isrepeat = true + + if scancode == button.quit then love.event.quit() end + + if scancode == button.a then + character.bola.actionA = true + end + + if scancode == button.left then + character.bola.actionLeft = true + end + + if scancode == button.right then + character.bola.actionRight = true + end + + if scancode == button.up then + character.bola.actionUp = true + end + + if scancode == button.down then + character.bola.actionDown = true + end +end + +function love.keyreleased(key, scancode) + if scancode == button.a then + character.bola.actionA = false + end + + if scancode == button.left then + character.bola.actionLeft = false + end + + if scancode == button.right then + character.bola.actionRight = false + end + + if scancode == button.up then + character.bola.actionUp = false + end + + if scancode == button.down then + character.bola.actionDown = false + end + + if scancode == button.b then + character.bola.actionB = false + end end function love.update(dt) diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/default.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/default.lua index aa04fac..08d7a10 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/default.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/default.lua @@ -10,4 +10,10 @@ return { walk = require 'scripts.bola.walk', run = require 'scripts.bola.run', jump = require 'scripts.bola.jump', + actionLeft = false, + actionRight = false, + actionUp = false, + actionDown = false, + actionA = false, + actionB = 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 0b6ad46..c87b51b 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 @@ -1,20 +1,25 @@ local motionModule = {} function motionModule.motion(dt) - if character.bola.jump.higher > 0 and love.keyboard.isScancodeDown(button.a) then + if character.bola.jump.higher > 0 and character.bola.actionA == true then jump(dt) else character.bola.jump.limitButtonJump = false end - if love.keyboard.isScancodeDown(button.left) then + if character.bola.actionLeft == true then walkLeft(dt) - elseif love.keyboard.isScancodeDown(button.right) then + end + + if character.bola.actionRight == true then walkRight(dt) end - if love.keyboard.isScancodeDown(button.up) then + + if character.bola.actionUp == true then walkUp(dt) - elseif love.keyboard.isScancodeDown(button.down) then + end + + if character.bola.actionDown == true then walkDown(dt) end end |