diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gnu_and_bola_brawlers/load/character.lua | 1 | ||||
-rw-r--r-- | src/gnu_and_bola_brawlers/meta_sprites/bola/fall.lua | 13 | ||||
-rw-r--r-- | src/gnu_and_bola_brawlers/update/default.lua | 29 |
3 files changed, 32 insertions, 11 deletions
diff --git a/src/gnu_and_bola_brawlers/load/character.lua b/src/gnu_and_bola_brawlers/load/character.lua index 5d2a6a4..a569994 100644 --- a/src/gnu_and_bola_brawlers/load/character.lua +++ b/src/gnu_and_bola_brawlers/load/character.lua @@ -21,6 +21,7 @@ return { stand = require 'meta_sprites/bola/stand', walk = require 'meta_sprites/bola/walk', jump = require 'meta_sprites/bola/jump', + fall = require 'meta_sprites/bola/fall', actionLeft = false, actionRight = false, actionUp = false, diff --git a/src/gnu_and_bola_brawlers/meta_sprites/bola/fall.lua b/src/gnu_and_bola_brawlers/meta_sprites/bola/fall.lua new file mode 100644 index 0000000..fae18b0 --- /dev/null +++ b/src/gnu_and_bola_brawlers/meta_sprites/bola/fall.lua @@ -0,0 +1,13 @@ +return { + love.graphics.newQuad(images.bola.x * 9, images.bola.y * 2, images.bola.x, images.bola.y, images.bola[1]:getDimensions()), + currentFrame = 1, + elapsedTime = 0, + fps = 1, + height = -250, + velocity = 0, + ground = windowProfile.mode.height / 2, + higher = 0.15, + higherMax = 0.15, + limitButtonJump = false, + isJumping = false, +} 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 |