summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)