From 5f53bd113305885017b5a8b95d72f66b0612dbba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Fabian=20Silva=20Delgado?= Date: Tue, 13 Dec 2016 18:29:16 -0300 Subject: Clean code --- .../main.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 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 fff4f5d..b966c71 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 @@ -155,17 +155,17 @@ function love.update(dt) 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 + sprite.currentFrame = 1 --Return to first frame else sprite.currentFrame = sprite.currentFrame + 1 --Next frame end end - metaSprites.quad = sprite[sprite.currentFrame] --Update with new fame + metaSprites.quad = sprite[sprite.currentFrame] --Update with new frame end animation(sprite.bola, metaSprites.bola, dt) - motion = function(character, metaSprites, dt) + motion = function(character, metaSprites, sprite, dt) if character.jump.higher > 0 and character.actionA == true then if character.jump.limitButtonJump == false then character.jump.higher = character.jump.higher - dt @@ -174,38 +174,38 @@ function love.update(dt) end if character.actionLeft == true and character.actionRight == false then - sprite.bola = require 'walk' + sprite = 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.bola = require 'walk' + sprite = 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.bola = require 'walk' + sprite = 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.bola = require 'walk' + sprite = 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.bola = require 'stand' + sprite = require 'stand' elseif character.actionLeft == true and character.actionRight == true then - sprite.bola = require 'stand' + sprite = require 'stand' elseif character.actionLeft == false and character.actionRight == false and character.actionUp == false and character.actionDown == false then - sprite.bola = require 'stand' + sprite = require 'stand' end end - motion(character.bola, metaSprites.bola, dt) + motion(character.bola, metaSprites.bola, sprite.bola, dt) gravity = function(character, dt) if character.jump.velocity ~= 0 then -- cgit v1.2.3