From e46f5716441becd4b2beb899c92bf34767ac89df Mon Sep 17 00:00:00 2001 From: beppe vanrolleghem Date: Sun, 2 Sep 2018 08:30:39 +0200 Subject: [PATCH] going to make a rhythm game hopefully, don't know if it'll work at all, it's gonna be procedually(?) generated --- gameworkplace/readme.md | 4 ++ gameworkplace/rhythm game/main.lua | 14 ++++ lib/gamemanager.lua | 107 +++++++++++++++++++++++++++++ 3 files changed, 125 insertions(+) create mode 100644 gameworkplace/readme.md create mode 100644 gameworkplace/rhythm game/main.lua create mode 100644 lib/gamemanager.lua diff --git a/gameworkplace/readme.md b/gameworkplace/readme.md new file mode 100644 index 0000000..e314a5d --- /dev/null +++ b/gameworkplace/readme.md @@ -0,0 +1,4 @@ + +# this is the place where i'll develop games before porting them into the main minigame thing + +the idea is that half of the games will be made with the touchscreen in mind and the other half are made with the buttons in mind \ No newline at end of file diff --git a/gameworkplace/rhythm game/main.lua b/gameworkplace/rhythm game/main.lua new file mode 100644 index 0000000..e21bc88 --- /dev/null +++ b/gameworkplace/rhythm game/main.lua @@ -0,0 +1,14 @@ + +function love.load() + +end + +function love.update(dt) + +end + +function love.draw() + +end + + diff --git a/lib/gamemanager.lua b/lib/gamemanager.lua new file mode 100644 index 0000000..d47a149 --- /dev/null +++ b/lib/gamemanager.lua @@ -0,0 +1,107 @@ +require "lib.tools.ui" + + + +require "lib.minigames.snake" +require "lib.minigames.swat" + + +--[[ + this library is the library that is combining the minigames into one usable thing, + it will also house the ui elements and general game management (duh). + +]] + + +man = { + paused = true, + debug = true, + tgame = "snake", --game thats happening on top screen + bgame = "swat", --game thats happening on bottom screen + lastkey = "" +} + + + +function man:load() + --love.graphics.set3D(true) + if not man.debug then + snakeplayer:hardreset() + swat:load() + ui:load() + end +end + +function man:update(dt) + if not man.debug then + if not man.paused then + if man.tgame == "snake" then + snakeplayer:update(dt) + end + if man.bgame == "swat" then + swat:update(dt) + end + else + ui:update(dt) + end + end +end + +function man:draw() + if not man.debug then + if not man.paused then + if man.tgame == "snake" then + snakeplayer:draw() + end + if man.bgame == "swat" then + fly:draw() + end + else + ui:draw() + end + else + love.graphics.print("the last button pressed was: "..man.lastkey) + end +end + +function man:keypressed(key) + if not man.debug then + if key == "start" then + man.paused = not man.paused + return + end + if not man.paused then + if man.tgame == "snake" then + snakeplayer:keypressed(key) + end + else + ui:keypressed(key) + end + else + man.lastkey = key + end +end + +function man:keyreleased(key) + if not man.debug then + if not man.paused then + + else + ui:keyreleased(key) + end + end +end + +function man:mousepressed(sx, sy) + local x, y = love.mouse.getPosition() + if not man.debug then + if not man.paused then + if man.bgame == "swat" then + swat:mousepressed(x, y) + end + else + ui:mousepressed(x, y) + end + end +end +