summaryrefslogtreecommitdiff
path: root/src/gnu_and_bola_brawlers/keyreleased/trigger.lua
blob: 7295131d9e170eb8d42f4c3f077b426d95b73b2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
local keyreleased = {}

keyreleased.trigger = function(character, key, controller, scancode)
  if scancode == controller.a then
    character.actionA     = false
  end

  if scancode == controller.left then
    character.actionLeft  = false
  end

  if scancode == controller.right then
    character.actionRight = false
  end

  if scancode == controller.up then
    character.actionUp    = false
  end

  if scancode == controller.down then
    character.actionDown  = false
  end

  if scancode == controller.b then
    character.actionB     = false
  end

  if scancode == controller.a then
    character.actionA = false

    if character.jump.velocity ~= 0 then
      character.jump.limitButtonJump = true
    end
  end
end

return keyreleased