blob: b650a5c7e3cd93db74c736cb8edc414270ebdc62 (
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
38
39
40
41
42
43
|
local keypressed = {}
keypressed.trigger = function(character, images, metaSprite, controller, key, scancode)
if scancode == controller.quit then
love.event.quit()
end
if scancode == controller.a then
character.actionA = true
character.actionDown = false
character.actionUp = false
character.jump.currentFrame = 1
character.jump.fps = 1
end
if scancode == controller.left then
character.actionLeft = true
character.walk.currentFrame = 1
character.walk.fps = 9
end
if scancode == controller.right then
character.actionRight = true
character.walk.currentFrame = 1
character.walk.fps = 9
end
if scancode == controller.up and character.jump.isJumping == false then
character.actionUp = true
character.walk.currentFrame = 1
character.walk.fps = 9
end
if scancode == controller.down and character.jump.isJumping == false then
character.actionDown = true
character.walk.currentFrame = 1
character.walk.fps = 9
end
return metaSprite
end
return keypressed
|