diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-12-06 18:12:40 -0300 |
---|---|---|
committer | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2016-12-06 18:50:10 -0300 |
commit | da2452f3bdcf5eff1bf1773a17b27a4deb8b8bad (patch) | |
tree | 338239c81e5a2ad1d1165528a64e19906ca3d8a9 | |
parent | 1e02fcb40d10b4f82fd726b01b4ffbffaf7c5463 (diff) |
Keep the code more KISS - part 8
8 files changed, 35 insertions, 51 deletions
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/animation.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/animation.lua index 8667ff6..ff5293d 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/animation.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/animation.lua @@ -1,7 +1,8 @@ game.animation = function(character, dt) character.elapsedTime = character.elapsedTime + dt if character.elapsedTime > (1 / character.fps) then ---[[ if character.loop > 0 then +--[[ + if character.loop > 0 then if loopCounter == nil then character.currentFrame = 1 loopCounter = 1 diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/jump.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/jump.lua deleted file mode 100644 index 1891af5..0000000 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/jump.lua +++ /dev/null @@ -1,9 +0,0 @@ -game.jump = function(metaSprites, character, dt) - 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) - - -- game.animation(character.jump, dt) - -- metaSprites.quad = character.jump[character.jump.currentFrame] - end -end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/motion.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/motion.lua index 7fb8fb0..3efc9c7 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/motion.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/motion.lua @@ -1,40 +1,60 @@ require 'scripts.game.animation' -require 'scripts.game.jump' -require 'scripts.game.stand' -require 'scripts.game.walk_left' -require 'scripts.game.walk_right' -require 'scripts.game.walk_up' -require 'scripts.game.walk_down' game.motion = function(metaSprites, character, dt) game.animation(character.stand, dt) metaSprites.quad = character.stand[character.stand.currentFrame] if character.jump.higher > 0 and character.actionA == true then - game.jump(metaSprites, character, dt) + if character.jump.limitButtonJump == false then +--[[ + game.animation(character.jump, dt) + metaSprites.quad = character.jump[character.jump.currentFrame] +]] + + character.jump.higher = character.jump.higher - dt + character.jump.velocity = character.jump.velocity + character.jump.height * (dt / character.jump.higherMax) + end end if character.actionLeft == true and character.actionRight == false then - game.walkLeft(metaSprites, character, dt) + game.animation(character.walk, dt) + metaSprites.quad = character.walk[character.walk.currentFrame] + + character.position.x = character.position.x - (character.velocity * dt) + character.scale.x = -1 end if character.actionRight == true and character.actionLeft == false then - game.walkRight(metaSprites, character, dt) + game.animation(character.walk, dt) + metaSprites.quad = character.walk[character.walk.currentFrame] + + character.position.x = character.position.x + (character.velocity * dt) + character.scale.x = 1 end if character.actionLeft == true and character.actionRight == true then - game.stand(metaSprites, character, dt) + game.animation(character.stand, dt) + metaSprites.quad = character.stand[character.stand.currentFrame] end if character.actionUp == true and character.actionDown == false then - game.walkUp(metaSprites, character, dt) + game.animation(character.walk, dt) + metaSprites.quad = character.walk[character.walk.currentFrame] + + character.position.y = character.position.y - (character.velocity * dt) + character.jump.ground = character.position.y end if character.actionDown == true and character.actionUp == false then - game.walkDown(metaSprites, character, dt) + game.animation(character.walk, dt) + metaSprites.quad = character.walk[character.walk.currentFrame] + + character.position.y = character.position.y + (character.velocity * dt) + character.jump.ground = character.position.y end if character.actionUp == true and character.actionDown == true then - game.stand(metaSprites, character, dt) + game.animation(character.stand, dt) + metaSprites.quad = character.stand[character.stand.currentFrame] end end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/stand.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/stand.lua deleted file mode 100644 index 3c31d68..0000000 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/stand.lua +++ /dev/null @@ -1,4 +0,0 @@ -game.stand = function(metaSprites, character, dt) - game.animation(character.stand, dt) - metaSprites.quad = character.stand[character.stand.currentFrame] -end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/walk_down.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/walk_down.lua deleted file mode 100644 index 26d8103..0000000 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/walk_down.lua +++ /dev/null @@ -1,6 +0,0 @@ -game.walkDown = function(metaSprites, character, dt) - character.position.y = character.position.y + (character.velocity * dt) - character.jump.ground = character.position.y - game.animation(character.walk, dt) - metaSprites.quad = character.walk[character.walk.currentFrame] -end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/walk_left.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/walk_left.lua deleted file mode 100644 index 9588f9c..0000000 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/walk_left.lua +++ /dev/null @@ -1,6 +0,0 @@ -game.walkLeft = function(metaSprites, character, dt) - character.position.x = character.position.x - (character.velocity * dt) - game.animation(character.walk, dt) - metaSprites.quad = character.walk[character.walk.currentFrame] - character.scale.x = -1 -end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/walk_right.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/walk_right.lua deleted file mode 100644 index 38ba327..0000000 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/walk_right.lua +++ /dev/null @@ -1,6 +0,0 @@ -game.walkRight = function(metaSprites, character, dt) - character.position.x = character.position.x + (character.velocity * dt) - game.animation(character.walk, dt) - metaSprites.quad = character.walk[character.walk.currentFrame] - character.scale.x = 1 -end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/walk_up.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/walk_up.lua deleted file mode 100644 index f85913c..0000000 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/game/walk_up.lua +++ /dev/null @@ -1,6 +0,0 @@ -game.walkUp = function(metaSprites, character, dt) - character.position.y = character.position.y - (character.velocity * dt) - character.jump.ground = character.position.y - game.animation(character.walk, dt) - metaSprites.quad = character.walk[character.walk.currentFrame] -end |