diff options
Diffstat (limited to 'src')
21 files changed, 100 insertions, 62 deletions
diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/draw/bola.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/draw/bola.lua new file mode 100644 index 0000000..116c72c --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/draw/bola.lua @@ -0,0 +1,15 @@ +draw.bola = function() + love.graphics.draw( + metaSprites.bola.image, + quad.bola, + character.bola.position.x, + character.bola.position.y, + character.bola.orientation, + character.bola.scale.x, + character.bola.scale.y, + character.bola.origin.x, + character.bola.origin.y + ) +-- bolaDraw.motion() +-- game.draw(metaSprites.bola, quad.bola, character.bola) +end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/draw/default.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/draw/default.lua index a13244a..060bb14 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/draw/default.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/draw/default.lua @@ -1,28 +1,13 @@ -main.draw = function() - local currentTime = love.timer.getTime() - if nextTime <= currentTime then - nextTime = currentTime - return - end - love.timer.sleep(nextTime - currentTime) - - love.graphics.scale(windowProfile.scale.x, windowProfile.scale.y) +draw = {} - love.graphics.print('FPS: ' .. love.timer.getFPS(), 0, 0) +require 'scripts.draw.fps' +require 'scripts.draw.scale' +require 'scripts.draw.printFPS' +require 'scripts.draw.bola' - draw = { - bola = love.graphics.draw( - metaSprites.bola.image, - quad.bola, - character.bola.position.x, - character.bola.position.y, - character.bola.orientation, - character.bola.scale.x, - character.bola.scale.y, - character.bola.origin.x, - character.bola.origin.y - ) - } --- bolaDraw.motion() --- game.draw(metaSprites.bola, quad.bola, character.bola) +main.draw = function() + draw.fps() + draw.scale() + draw.printFPS() + draw.bola() end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/draw/fps.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/draw/fps.lua new file mode 100644 index 0000000..efb2652 --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/draw/fps.lua @@ -0,0 +1,8 @@ +draw.fps = function() + local currentTime = love.timer.getTime() + if nextTime <= currentTime then + nextTime = currentTime + return + end + love.timer.sleep(nextTime - currentTime) +end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/draw/printFPS.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/draw/printFPS.lua new file mode 100644 index 0000000..774deb4 --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/draw/printFPS.lua @@ -0,0 +1,3 @@ +draw.printFPS = function() + love.graphics.print('FPS: ' .. love.timer.getFPS(), 0, 0) +end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/draw/scale.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/draw/scale.lua new file mode 100644 index 0000000..3e6f2e6 --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/draw/scale.lua @@ -0,0 +1,3 @@ +draw.scale = function() + love.graphics.scale(windowProfile.scale.x, windowProfile.scale.y) +end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/button.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/button.lua new file mode 100644 index 0000000..b14e80b --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/button.lua @@ -0,0 +1,3 @@ +load.button = function() + button = require 'scripts.player.1.button' +end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/character.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/character.lua new file mode 100644 index 0000000..bf1cc65 --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/character.lua @@ -0,0 +1,5 @@ +character = {} + +load.character = function() + character.bola = require 'scripts.bola.default' +end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/default.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/default.lua index 31b8f9b..e28d82b 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/default.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/default.lua @@ -1,18 +1,19 @@ -main.load = function() - fps = 30 - upTime = love.timer.getTime() - nextTime = upTime - windowProfile = require 'scripts.window.profile' - - love.graphics.setBackgroundColor(0, 232, 216) - love.graphics.setDefaultFilter('nearest', 'nearest') - love.window.setMode(windowProfile.mode.width * windowProfile.scale.x, windowProfile.mode.height * windowProfile.scale.y) - love.window.setTitle(windowProfile.title) +load = {} - button = require 'scripts.player.1.button' - metaSprites = require 'scripts.meta_sprites' +require 'scripts.load.fps' +require 'scripts.load.window_profile' +require 'scripts.load.graphics' +require 'scripts.load.window' +require 'scripts.load.button' +require 'scripts.load.meta_sprites.default' +require 'scripts.load.character' - character = { - bola = require 'scripts.bola.default' - } +main.load = function() + load.fps() + load.windowProfile() + load.graphics() + load.window() + load.button() + load.metaSprites() + load.character() end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/fps.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/fps.lua new file mode 100644 index 0000000..33f7c8d --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/fps.lua @@ -0,0 +1,5 @@ +load.fps = function() + fps = 30 + upTime = love.timer.getTime() + nextTime = upTime +end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/gpu/mali400.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/gpu/mali400.lua index 5570d82..5570d82 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/gpu/mali400.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/gpu/mali400.lua diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/gpu/ppu_rp2c02.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/gpu/ppu_rp2c02.lua index d60214d..d60214d 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/gpu/ppu_rp2c02.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/gpu/ppu_rp2c02.lua diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/gpu/s-ppux_5c7x-0x.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/gpu/s-ppux_5c7x-0x.lua index 928ee80..928ee80 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/gpu/s-ppux_5c7x-0x.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/gpu/s-ppux_5c7x-0x.lua diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/graphics.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/graphics.lua new file mode 100644 index 0000000..3f78ca6 --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/graphics.lua @@ -0,0 +1,4 @@ +load.graphics = function() + love.graphics.setBackgroundColor(0, 232, 216) + love.graphics.setDefaultFilter('nearest', 'nearest') +end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/meta_sprites/bola.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/meta_sprites/bola.lua new file mode 100644 index 0000000..58e4fa6 --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/meta_sprites/bola.lua @@ -0,0 +1,5 @@ +return { + image = love.graphics.newImage('multimedia/ppu_rp2c0x/meta_sprites/bola/default_sheet_color0_alpha.png'), + x = 24, + y = 32, +} diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/meta_sprites/default.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/meta_sprites/default.lua new file mode 100644 index 0000000..a57a85b --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/meta_sprites/default.lua @@ -0,0 +1,5 @@ +load.metaSprites = function() + metaSprites = { + bola = require 'scripts.load.meta_sprites.bola', + } +end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/window.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/window.lua new file mode 100644 index 0000000..eed886e --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/window.lua @@ -0,0 +1,4 @@ +load.window = function() + love.window.setMode(windowProfile.mode.width * windowProfile.scale.x, windowProfile.mode.height * windowProfile.scale.y) + love.window.setTitle(windowProfile.title) +end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/window_profile.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/window_profile.lua new file mode 100644 index 0000000..c336b79 --- /dev/null +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/load/window_profile.lua @@ -0,0 +1,13 @@ +load.windowProfile = function() + windowProfile = { + mode = { + width = 256, + height = 240, + }, + scale = { + x = 2, + y = 2, + }, + title = "GNU & Bola - The libre beat'em up game", + } +end diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/meta_sprites.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/meta_sprites.lua deleted file mode 100644 index fca94dd..0000000 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/meta_sprites.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - bola = { - image = love.graphics.newImage('multimedia/ppu_rp2c0x/meta_sprites/bola/default_sheet_color0_alpha.png'), - x = 24, - y = 32, - } -} diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/gravity.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/gravity.lua index 5242f90..7e28588 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/gravity.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/gravity.lua @@ -1,8 +1,4 @@ update.gravity = function(dt) - gravity(dt) -end - -function gravity(dt) if character.bola.jump.velocity ~= 0 then character.bola.jump.isJumping = true character.bola.position.y = character.bola.position.y + (character.bola.jump.velocity * dt) diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/limit.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/limit.lua index 9df7079..3990db0 100644 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/limit.lua +++ b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/update/limit.lua @@ -4,6 +4,7 @@ update.limit = function(dt) elseif character.bola.position.x >= windowProfile.mode.width - character.bola.origin.x then character.bola.position.x = windowProfile.mode.width - character.bola.origin.x end + if character.bola.position.y <= character.bola.origin.y then character.bola.position.y = character.bola.origin.y elseif character.bola.position.y >= windowProfile.mode.height - character.bola.origin.y then diff --git a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/window/profile.lua b/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/window/profile.lua deleted file mode 100644 index 652921e..0000000 --- a/src/gnu_and_bola_-_the_libre_beat_em_up_game/scripts/window/profile.lua +++ /dev/null @@ -1,11 +0,0 @@ -return { - mode = { - width = 256, - height = 240, - }, - scale = { - x = 2, - y = 2, - }, - title = "GNU & Bola - The libre beat'em up game", -} |