summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2016-12-15 00:58:39 -0300
committercoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2016-12-15 00:58:39 -0300
commited12f36695b2c30bf2f9fd77c71fcdcbc402e324 (patch)
tree904ec26ab1f837fe02779e5099f8d997d7d0f6a8
parent3657811d78bd811acf25668fe3224806d9b1d6d8 (diff)
Rename "sprite" to "metaSprite"
-rw-r--r--src/gnu_and_bola_brawlers/load/initialize.lua2
-rw-r--r--src/gnu_and_bola_brawlers/main.lua44
2 files changed, 23 insertions, 23 deletions
diff --git a/src/gnu_and_bola_brawlers/load/initialize.lua b/src/gnu_and_bola_brawlers/load/initialize.lua
index 545b6cf..49582b1 100644
--- a/src/gnu_and_bola_brawlers/load/initialize.lua
+++ b/src/gnu_and_bola_brawlers/load/initialize.lua
@@ -18,7 +18,7 @@ load.initialize = function()
images = require 'load/images'
character = require 'load/character'
- sprite = {
+ metaSprite = {
bola = require 'stand',
}
end
diff --git a/src/gnu_and_bola_brawlers/main.lua b/src/gnu_and_bola_brawlers/main.lua
index 3677fd4..a0e406f 100644
--- a/src/gnu_and_bola_brawlers/main.lua
+++ b/src/gnu_and_bola_brawlers/main.lua
@@ -4,7 +4,7 @@ function love.load()
end
function love.keypressed(key, scancode)
- keypressed = function(character, images, sprite, controller, key, scancode)
+ keypressed = function(character, images, metaSprite, controller, key, scancode)
if scancode == playerController.quit then
love.event.quit()
end
@@ -13,7 +13,7 @@ function love.keypressed(key, scancode)
character.actionA = true
character.actionDown = false
character.actionUp = false
- sprite = require 'jump'
+ metaSprite = require 'jump'
end
if scancode == controller.left then
@@ -32,7 +32,7 @@ function love.keypressed(key, scancode)
character.actionDown = true
end
end
- keypressed(character.bola, images.bola, sprite.bola, playerController.player1, key, scancode)
+ keypressed(character.bola, images.bola, metaSprite.bola, playerController.player1, key, scancode)
end
function love.keyreleased(key, scancode)
@@ -75,25 +75,25 @@ end
function love.update(dt)
nextTime = nextTime + (1 / fps)
- animation = function(sprite, images, dt)
+ animation = function(metaSprite, images, dt)
--Increase actual elapsed time with new dt
- sprite.elapsedTime = sprite.elapsedTime + dt --AnimationStart
+ metaSprite.elapsedTime = metaSprite.elapsedTime + dt --AnimationStart
--In order to know if it is necessary to change the 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
+ if metaSprite.elapsedTime >= (1 / metaSprite.fps) then
+ metaSprite.elapsedTime = metaSprite.elapsedTime - (1 / metaSprite.fps)
+ if metaSprite.currentFrame == # metaSprite then --If current frame is equal to long metaSprite list
+ metaSprite.currentFrame = 1 -- Return to first frame
else
- sprite.currentFrame = sprite.currentFrame + 1 --Next frame
+ metaSprite.currentFrame = metaSprite.currentFrame + 1 --Next frame
end
end
- images.quad = sprite[sprite.currentFrame] --Update with new fame
+ images.quad = metaSprite[metaSprite.currentFrame] --Update with new fame
end
- animation(sprite.bola, images.bola, dt)
+ animation(metaSprite.bola, images.bola, dt)
- motion = function(character, images, sprite, dt)
+ motion = function(character, images, metaSprite, dt)
if character.jump.higher > 0 and character.actionA == true then
if character.jump.limitButtonJump == false then
character.jump.higher = character.jump.higher - dt
@@ -102,40 +102,40 @@ function love.update(dt)
end
if character.actionLeft == true and character.actionRight == false then
- sprite = require 'walk'
+ metaSprite = 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
- sprite = require 'walk'
+ metaSprite = 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
- sprite = require 'walk'
+ metaSprite = 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
- sprite = require 'walk'
+ metaSprite = 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
- sprite = require 'stand'
+ metaSprite = require 'stand'
elseif character.actionLeft == true and character.actionRight == true then
- sprite = require 'stand'
+ metaSprite = require 'stand'
elseif character.actionLeft == false and character.actionRight == false and character.actionUp == false and character.actionDown == false then
- sprite = require 'stand'
+ metaSprite = require 'stand'
end
- return sprite
+ return metaSprite
end
- sprite.bola = motion(character.bola, images.bola, sprite.bola, dt)
+ metaSprite.bola = motion(character.bola, images.bola, metaSprite.bola, dt)
gravity = function(character, dt)
if character.jump.velocity ~= 0 then