From 423af2344d0e26795ce1eb5619888930238bfef3 Mon Sep 17 00:00:00 2001 From: "coadde [Márcio Alexandre Silva Delgado]" Date: Thu, 1 Dec 2016 02:33:47 -0300 Subject: Replace love.keyboard.isScancodeDown() to love.keypressed() and love.keyreleased() --- .../main.lua | 52 +++++++++++++++++++++- 1 file changed, 50 insertions(+), 2 deletions(-) (limited to 'src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua') 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) -- cgit v1.2.3-54-g00ecf