summaryrefslogtreecommitdiff
path: root/src/gnu_and_bola_brawlers/update
diff options
context:
space:
mode:
Diffstat (limited to 'src/gnu_and_bola_brawlers/update')
-rw-r--r--src/gnu_and_bola_brawlers/update/default.lua29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/gnu_and_bola_brawlers/update/default.lua b/src/gnu_and_bola_brawlers/update/default.lua
index 064f7d0..d53dbc3 100644
--- a/src/gnu_and_bola_brawlers/update/default.lua
+++ b/src/gnu_and_bola_brawlers/update/default.lua
@@ -23,21 +23,36 @@ update.animation = function(metaSprite, images, dt)
end
update.motion = function(character, images, metaSprite, dt)
- if character.jump.higher > 0 and character.actionA == true then
+ if character.actionUp == true and character.actionDown == true then
+ metaSprite = character.stand
+ elseif character.actionLeft == true and character.actionRight == true then
+ metaSprite = character.stand
+ elseif character.actionLeft == false and character.actionRight == false and character.actionUp == false and character.actionDown == false and character.jump.higher > 0 and character.actionA == false then
+ metaSprite = character.stand
+ end
+
+ if character.jump.higher > 0 and character.actionUp == false and character.actionDown == false and character.actionA == true then
+ metaSprite = character.jump
if character.jump.limitButtonJump == false then
character.jump.higher = character.jump.higher - dt
character.jump.velocity = character.jump.velocity + character.jump.height * (dt / character.jump.higherMax)
end
+ elseif character.jump.higher < 0 and character.actionUp == false and character.actionDown == false and character.actionA == false then
+ metaSprite = character.fall
end
if character.actionLeft == true and character.actionRight == false then
- metaSprite = character.walk
+ if character.jump.higher > 0 and character.actionA == false then
+ metaSprite = character.walk
+ end
character.position.x = character.position.x - (character.velocity * dt)
character.scale.x = -1
end
if character.actionRight == true and character.actionLeft == false then
- metaSprite = character.walk
+ if character.jump.higher > 0 and character.actionA == false then
+ metaSprite = character.walk
+ end
character.position.x = character.position.x + (character.velocity * dt)
character.scale.x = 1
end
@@ -54,14 +69,6 @@ update.motion = function(character, images, metaSprite, dt)
character.jump.ground = character.position.y
end
- if character.actionUp == true and character.actionDown == true then
- metaSprite = character.stand
- elseif character.actionLeft == true and character.actionRight == true then
- metaSprite = character.stand
- elseif character.actionLeft == false and character.actionRight == false and character.actionUp == false and character.actionDown == false then
- metaSprite = character.stand
- end
-
return metaSprite
end