Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- game = {}
- game.time = 0
- game.s = 0
- width, height, flags = love.window.getMode()
- status = nil
- eqnx = 0
- levelOne = {
- q = 0,
- w = eqnx,
- e = eqnx^2
- }
- levelTwo = {
- q = math.sin(math.rad(eqnx)),
- w = .5*eqnx,
- e = 2.71828^eqnx
- }
- levelThree = {
- q = (eqnx^2) / (eqnx + 2),
- w = math.log(eqnx) + 1,
- e = 5*(math.cos(math.rad(eqnx))^2)
- }
- currentLevel = levelOne
- function game.menu()
- drawGameMenu()
- player.draw()
- end
- function game.start()
- player.start()
- status = "resume"
- end
- function game.stop()--remove?
- --pause player and rendering
- status = "menu"
- end
- function game.pause()
- end
- function game.resume(game.s)
- love.graphics.setBackgroundColor(26,26,26)
- player.draw()
- player.step(game.s)
- end
- function game.step(s)
- --print(status)
- game.time = game.time + s
- game.s = s
- if love.keyboard.isDown("space") then
- if not status then
- status = "start"
- elseif status == "menu" then status = "resume"
- end
- elseif love.keyboard.isDown("escape") then
- if status then
- if status ~= "menu" then
- status = "stop"
- end
- end
- end
- end
- function drawMainMenu()
- love.graphics.setBackgroundColor(26,26,26)
- love.graphics.setColor(255,255,255,200)
- love.graphics.printf("GENERIC TITLE HERE", 0, height/2 - 120, width, "center")
- love.graphics.printf([[
- behold you are a flying orb
- use keys to move
- maths
- space inverts ur movement
- press space to begin
- ]], 0, height/2 - 40, width, "center")
- end
- function drawGameMenu()
- love.graphics.setBackgroundColor(16,16,16)
- love.graphics.printf([[paused :)
- press space to resume
- ]], 0, height/2 - 40, width, "center")
- end
- function game.draw()
- if not status then
- drawMainMenu()
- else
- game[status]()
- end
- end
- return game
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement