summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-12-18 12:05:02 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-12-18 13:36:07 -0300
commita326d8cb81cb20bd2ef8e5f6f313efab3599c16a (patch)
tree5b324acd345cc6d5fe8feed23d75a2e8ecfeb683
parent49b7a1b4f07515840212595dee16d277f186aeca (diff)
Restart animation frames every time when a key is pressed
-rw-r--r--src/gnu_and_bola_brawlers/keypressed/default.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gnu_and_bola_brawlers/keypressed/default.lua b/src/gnu_and_bola_brawlers/keypressed/default.lua
index 07bb9bf..b650a5c 100644
--- a/src/gnu_and_bola_brawlers/keypressed/default.lua
+++ b/src/gnu_and_bola_brawlers/keypressed/default.lua
@@ -9,23 +9,32 @@ keypressed.trigger = function(character, images, metaSprite, controller, key, sc
character.actionA = true
character.actionDown = false
character.actionUp = false
- metaSprite = character.jump
+ 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