diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-12-18 14:37:04 -0300 |
---|---|---|
committer | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2016-12-18 20:53:59 -0300 |
commit | f32c2d8b20865b11960fbf440d979a58920082de (patch) | |
tree | 459e5968e711a8ccdf513d5ef680e7220bae9c1c /src/gnu_and_bola_brawlers/update/default.lua | |
parent | 481365f7926372a931c0a43ee54a3b05ed36a9e1 (diff) |
Enable initial jumping animation
Diffstat (limited to 'src/gnu_and_bola_brawlers/update/default.lua')
-rw-r--r-- | src/gnu_and_bola_brawlers/update/default.lua | 29 |
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 |