summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2016-12-03 01:58:51 -0300
committercoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2016-12-03 01:58:51 -0300
commitcc5000abb51b03dbba8ac05ece193d5f197fcf71 (patch)
tree64ef6a1311162bbf706164afd27fd1bc118f1391 /src
parent4c2c9a5b98804b3a676b6d72a7ac07b08a58b36a (diff)
Fix walking animation
Diffstat (limited to 'src')
-rw-r--r--src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/motion.lua21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/motion.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/motion.lua
index 2cf232a..effd9ce 100644
--- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/motion.lua
+++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/motion.lua
@@ -5,21 +5,29 @@ function motionModule.motion(dt)
jump(dt)
end
- if character.bola.actionLeft == true then
+ if character.bola.actionLeft == true and character.bola.actionRight == false then
walkLeft(dt)
end
- if character.bola.actionRight == true then
+ if character.bola.actionRight == true and character.bola.actionLeft == false then
walkRight(dt)
end
- if character.bola.actionUp == true then
+ if character.bola.actionLeft == true and character.bola.actionRight == true then
+ stand(dt)
+ end
+
+ if character.bola.actionUp == true and character.bola.actionDown == false then
walkUp(dt)
end
- if character.bola.actionDown == true then
+ if character.bola.actionDown == true and character.bola.actionUp == false then
walkDown(dt)
end
+
+ if character.bola.actionUp == true and character.bola.actionDown == true then
+ stand(dt)
+ end
end
function jump(dt)
@@ -32,6 +40,11 @@ function jump(dt)
end
end
+function stand(dt)
+ character.bola.stand.start = game.animation(character.bola.stand.start, character.bola.stand.fps, frames.bola.stand, -1)
+ quad.bola = character.bola.stand[math.floor(character.bola.stand.start)]
+end
+
function walkLeft(dt)
character.bola.position.x = character.bola.position.x - (character.bola.velocity * dt)
character.bola.walk.start = game.animation(character.bola.walk.start, character.bola.walk.fps, frames.bola.walk, -1)