diff options
author | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2016-12-01 02:33:47 -0300 |
---|---|---|
committer | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2016-12-01 02:33:47 -0300 |
commit | 423af2344d0e26795ce1eb5619888930238bfef3 (patch) | |
tree | e1612bdfe36335336c8df616938f87e928fc9805 /src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua | |
parent | 0244b9e8e673dd8694196220779f7f7fbb9a24ee (diff) |
Replace love.keyboard.isScancodeDown() to love.keypressed() and love.keyreleased()
Diffstat (limited to 'src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua')
-rw-r--r-- | src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua | 52 |
1 files changed, 50 insertions, 2 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) |