diff options
author | André Fabian Silva Delgado <emulatorman@parabola.nu> | 2016-12-21 07:53:53 -0300 |
---|---|---|
committer | coadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu> | 2016-12-21 15:24:18 -0300 |
commit | 12a3375e4f65ef562b4a1f8097c8f4b3baf83eb1 (patch) | |
tree | c45c9f19daa4b2f66d419e140aee6a96b018d376 /src/gnu_and_bola_brawlers/update | |
parent | 245c9b7d7f37a37d20bdc224eb57b0aabea0cfe4 (diff) |
Fix English grammar and add more comments
Diffstat (limited to 'src/gnu_and_bola_brawlers/update')
-rw-r--r-- | src/gnu_and_bola_brawlers/update/default.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gnu_and_bola_brawlers/update/default.lua b/src/gnu_and_bola_brawlers/update/default.lua index b14349b..1ea8b10 100644 --- a/src/gnu_and_bola_brawlers/update/default.lua +++ b/src/gnu_and_bola_brawlers/update/default.lua @@ -12,18 +12,18 @@ update.animation = function(metaSprite, images, dt) --In order to know if it is necessary to change the 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 + if metaSprite.currentFrame == # metaSprite then --If current frame is equal to the long metaSprite list + metaSprite.currentFrame = 1 --Return to the first frame else metaSprite.currentFrame = metaSprite.currentFrame + 1 --Next frame end end - images.quad = metaSprite[metaSprite.currentFrame] --Update with new fame + images.quad = metaSprite[metaSprite.currentFrame] --Update with new frame end update.motion = function(character, images, metaSprite, dt) - -- Check if press button up/down, left/right at same time, no button press and character is not jumping then metaSprite is stand + -- Character will be stand if player press up/down, left/right buttons at the same time or when don't press any button if ((character.actionUp == true and character.actionDown == true) or (character.actionLeft == true and character.actionRight == true) or (character.actionLeft == false and character.actionRight == false and character.actionUp == false and character.actionDown == false)) and character.actionA == false and character.jump.isJumping == false then if metaSprite ~= character.stand then print("(update.motion) -> load stand meta sprite") @@ -106,6 +106,7 @@ update.motion = function(character, images, metaSprite, dt) return metaSprite end +--Apply gravity when jumping/falling update.gravity = function(character, dt) if character.jump.velocity ~= 0 then character.jump.isJumping = true @@ -130,6 +131,7 @@ update.gravity = function(character, dt) end end +--Limit window screen for characters update.limit = function(character, dt) if character.position.x <= character.origin.x then character.position.x = character.origin.x |