diff options
author | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2016-11-24 04:23:57 -0300 |
---|---|---|
committer | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2016-11-24 04:23:57 -0300 |
commit | 7c0b99d56d0f25cd22f9914f0a17fcf581fb945d (patch) | |
tree | 6c8e0d7b111ecd236176930a8332eb941341f25b /src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts | |
parent | 61803e6ea2e0ff2e19f2e74cc51dac521c214277 (diff) |
Add crouchDown/standUp modules, fix origin module and rename down() to crouch()
Diffstat (limited to 'src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts')
8 files changed, 106 insertions, 23 deletions
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/animation.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/animation.lua index 6bb58c2..e3c714e 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/animation.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/animation.lua @@ -1,9 +1,11 @@ local animationModule = {} function animationModule.animation(dt) - character.bola.stand.start = character.bola.stand.start + (dt * character.bola.stand.fps) - character.bola.walk.start = character.bola.walk.start + (dt * character.bola.walk.fps) - character.bola.crouch.start = character.bola.crouch.start + (dt * character.bola.crouch.fps) + character.bola.stand.start = character.bola.stand.start + (dt * character.bola.stand.fps) + character.bola.walk.start = character.bola.walk.start + (dt * character.bola.walk.fps) + character.bola.crouchDown.start = character.bola.crouchDown.start + (dt * character.bola.crouchDown.fps) + character.bola.crouch.start = character.bola.crouch.start + (dt * character.bola.crouch.fps) + character.bola.standUp.start = character.bola.standUp.start + (dt * character.bola.standUp.fps) frames = { bola = require 'scripts.bola.frames' @@ -32,9 +34,11 @@ function animationModule.animation(dt) end } - character.bola.stand.start = game.animation(character.bola.stand.start, frames.bola.stand, -1) - character.bola.walk.start = game.animation(character.bola.walk.start, frames.bola.walk, -1) - character.bola.crouch.start = game.animation(character.bola.crouch.start, frames.bola.crouch, -1) + character.bola.stand.start = game.animation(character.bola.stand.start, frames.bola.stand, -1) + character.bola.walk.start = game.animation(character.bola.walk.start, frames.bola.walk, -1) + character.bola.crouchDown.start = game.animation(character.bola.crouchDown.start, frames.bola.crouchDown, 0) + character.bola.crouch.start = game.animation(character.bola.crouch.start, frames.bola.crouch, -1) + character.bola.standUp.start = game.animation(character.bola.standUp.start, frames.bola.standUp, 0) transform = { bola = { diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/crouch.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/crouch.lua index cf26105..37d98a1 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/crouch.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/crouch.lua @@ -1,5 +1,11 @@ return { - love.graphics.newQuad(metaSprites.bola.x * 2, metaSprites.bola.y * 2, metaSprites.bola.x, metaSprites.bola.y / 2, metaSprites.bola.image:getDimensions()), + love.graphics.newQuad( + metaSprites.bola.x * 2, + metaSprites.bola.y * 2, + metaSprites.bola.x, + metaSprites.bola.y / 2, + metaSprites.bola.image:getDimensions() + ), start = 1, fps = 9, } diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/crouch_down.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/crouch_down.lua new file mode 100644 index 0000000..aa06f93 --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/crouch_down.lua @@ -0,0 +1,25 @@ +return { + love.graphics.newQuad( + metaSprites.bola.x * 0, + metaSprites.bola.y * 2, + metaSprites.bola.x, + metaSprites.bola.y, + metaSprites.bola.image:getDimensions() + ), + love.graphics.newQuad( + metaSprites.bola.x * 1, + metaSprites.bola.y * 2, + metaSprites.bola.x, + metaSprites.bola.y / 4, + metaSprites.bola.image:getDimensions() + ), + love.graphics.newQuad( + metaSprites.bola.x * 2, + (metaSprites.bola.y * 2) + (metaSprites.bola.y / 2), + metaSprites.bola.x, + metaSprites.bola.y / 2, + metaSprites.bola.image:getDimensions() + ), + start = 1, + fps = 9, +} diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/default.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/default.lua index ed1460b..00885ad 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/default.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/default.lua @@ -1,12 +1,14 @@ return { - orientation = 0, + orientation = 0, acceleration = 0, - speed = 125, - position = require 'scripts.bola.position', - scale = require 'scripts.bola.scale', - origin = require 'scripts.bola.origin', - stand = require 'scripts.bola.stand', - walk = require 'scripts.bola.walk', - run = require 'scripts.bola.run', - crouch = require 'scripts.bola.crouch', + speed = 125, + position = require 'scripts.bola.position', + scale = require 'scripts.bola.scale', + origin = require 'scripts.bola.origin', + stand = require 'scripts.bola.stand', + walk = require 'scripts.bola.walk', + run = require 'scripts.bola.run', + crouchDown = require 'scripts.bola.crouch_down', + crouch = require 'scripts.bola.crouch', + standUp = require 'scripts.bola.stand_up', } diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/frames.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/frames.lua index 77999e6..2f8ba5f 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/frames.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/frames.lua @@ -1,5 +1,7 @@ return { - stand = # character.bola.stand, - walk = # character.bola.walk, - crouch = # character.bola.crouch, + stand = # character.bola.stand, + walk = # character.bola.walk, + crouchDown = # character.bola.crouchDown, + crouch = # character.bola.crouch, + standUp = # character.bola.standUp, } 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 d153207..08cc791 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 @@ -6,7 +6,7 @@ function motionModule.motion(dt) elseif love.keyboard.isDown(button.right) then right(dt) elseif love.keyboard.isDown(button.down) then - down(dt) + crouch(dt) else stand(dt) end @@ -42,11 +42,11 @@ function right(dt) character.bola.scale.x = 1 end -function down(dt) +function crouch(dt) character.bola.acceleration = 0 - transform.bola.origin.y = character.bola.origin.y - character.bola.origin.y + transform.bola.origin.y = character.bola.origin.crouch.y[math.floor(character.bola.crouch.start)] quad = { - bola = character.bola.crouch[1] + bola = character.bola.crouch[math.floor(character.bola.crouch.start)] } end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/origin.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/origin.lua index b84ffb5..edfa741 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/origin.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/origin.lua @@ -1,4 +1,23 @@ return { x = metaSprites.bola.x / 2, y = metaSprites.bola.y / 2, + crouchDown = { + y = { + metaSprites.bola.x / 2, + (metaSprites.bola.y / 2) - (metaSprites.bola.y / 4), + (metaSprites.bola.y / 2) - (metaSprites.bola.y / 2), + }, + }, + crouch = { + y = { + (metaSprites.bola.y / 2) - (metaSprites.bola.y / 2), + }, + }, + standUp = { + y = { + (metaSprites.bola.y / 2) - (metaSprites.bola.y / 2), + (metaSprites.bola.y / 2) - (metaSprites.bola.y / 4), + metaSprites.bola.x / 2, + }, + }, } diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/stand_up.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/stand_up.lua new file mode 100644 index 0000000..7eae397 --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/bola/stand_up.lua @@ -0,0 +1,25 @@ +return { + love.graphics.newQuad( + metaSprites.bola.x * 2, + (metaSprites.bola.y * 2) + (metaSprites.bola.y / 2), + metaSprites.bola.x, + metaSprites.bola.y / 2, + metaSprites.bola.image:getDimensions() + ), + love.graphics.newQuad( + metaSprites.bola.x * 1, + metaSprites.bola.y * 2, + metaSprites.bola.x, + metaSprites.bola.y / 4, + metaSprites.bola.image:getDimensions() + ), + love.graphics.newQuad( + metaSprites.bola.x * 0, + metaSprites.bola.y * 2, + metaSprites.bola.x, + metaSprites.bola.y, + metaSprites.bola.image:getDimensions() + ), + start = 1, + fps = 9, +} |