diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-12-13 17:59:50 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-12-13 17:59:50 -0300 |
commit | 012f66db6d8d01df344b44788aaece7e07ee9be6 (patch) | |
tree | d69ce141efb3e8c9de014368e2fcadba5cc7de64 | |
parent | 76490cde2af5d2ef71bf4c6474c38fdb4b236e17 (diff) |
Rename quad to sprite
-rw-r--r-- | src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua index f1fa96f..fff4f5d 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/main.lua @@ -70,13 +70,13 @@ function love.load() actionB = false, }, } - quad = { + sprite = { bola = require 'stand', } end function love.keypressed(key, scancode) - keypressed = function(character, metaSprites, quad, key, scancode) + keypressed = function(character, metaSprites, sprite, key, scancode) if scancode == button.quit then love.event.quit() end @@ -85,7 +85,7 @@ function love.keypressed(key, scancode) character.actionA = true character.actionDown = false character.actionUp = false - quad = require 'jump' + sprite = require 'jump' end if scancode == button.left then @@ -104,7 +104,7 @@ function love.keypressed(key, scancode) character.actionDown = true end end - keypressed(character.bola, metaSprites.bola, quad.bola, key, scancode) + keypressed(character.bola, metaSprites.bola, sprite.bola, key, scancode) end function love.keyreleased(key, scancode) @@ -147,23 +147,23 @@ end function love.update(dt) nextTime = nextTime + (1 / fps) - animation = function(quad, metaSprites, dt) + animation = function(sprite, metaSprites, dt) --Increase actual elapsed time with new dt - quad.elapsedTime = quad.elapsedTime + dt --AnimationStart + sprite.elapsedTime = sprite.elapsedTime + dt --AnimationStart --In order to know if it is necessary to change the frame - if quad.elapsedTime >= (1 / quad.fps) then - quad.elapsedTime = quad.elapsedTime - (1 / quad.fps) - if quad.currentFrame == # quad then --If current frame is equal to long quad list - quad.currentFrame = 1 -- Return to first frame + if sprite.elapsedTime >= (1 / sprite.fps) then + sprite.elapsedTime = sprite.elapsedTime - (1 / sprite.fps) + if sprite.currentFrame == # sprite then --If current frame is equal to long sprite list + sprite.currentFrame = 1 -- Return to first frame else - quad.currentFrame = quad.currentFrame + 1 --Next frame + sprite.currentFrame = sprite.currentFrame + 1 --Next frame end end - metaSprites.quad = quad[quad.currentFrame] --Update with new fame + metaSprites.quad = sprite[sprite.currentFrame] --Update with new fame end - animation(quad.bola, metaSprites.bola, dt) + animation(sprite.bola, metaSprites.bola, dt) motion = function(character, metaSprites, dt) if character.jump.higher > 0 and character.actionA == true then @@ -174,35 +174,35 @@ function love.update(dt) end if character.actionLeft == true and character.actionRight == false then - quad.bola = require 'walk' + sprite.bola = require 'walk' character.position.x = character.position.x - (character.velocity * dt) character.scale.x = -1 end if character.actionRight == true and character.actionLeft == false then - quad.bola = require 'walk' + sprite.bola = require 'walk' character.position.x = character.position.x + (character.velocity * dt) character.scale.x = 1 end if character.actionUp == true and character.actionDown == false then - quad.bola = require 'walk' + sprite.bola = require 'walk' 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 - quad.bola = require 'walk' + sprite.bola = require 'walk' 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 - quad.bola = require 'stand' + sprite.bola = require 'stand' elseif character.actionLeft == true and character.actionRight == true then - quad.bola = require 'stand' + sprite.bola = require 'stand' elseif character.actionLeft == false and character.actionRight == false and character.actionUp == false and character.actionDown == false then - quad.bola = require 'stand' + sprite.bola = require 'stand' end end motion(character.bola, metaSprites.bola, dt) |