Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. game = {}
  2. game.time = 0
  3. game.s = 0
  4.  
  5. width, height, flags = love.window.getMode()
  6. status = nil
  7.  
  8. eqnx = 0
  9.  
  10. levelOne = {
  11. q = 0,
  12. w = eqnx,
  13. e = eqnx^2
  14. }
  15. levelTwo = {
  16. q = math.sin(math.rad(eqnx)),
  17. w = .5*eqnx,
  18. e = 2.71828^eqnx
  19. }
  20. levelThree = {
  21. q = (eqnx^2) / (eqnx + 2),
  22. w = math.log(eqnx) + 1,
  23. e = 5*(math.cos(math.rad(eqnx))^2)
  24. }
  25.  
  26. currentLevel = levelOne
  27.  
  28. function game.menu()
  29. drawGameMenu()
  30. player.draw()
  31. end
  32.  
  33. function game.start()
  34. player.start()
  35. status = "resume"
  36. end
  37.  
  38. function game.stop()--remove?
  39. --pause player and rendering
  40. status = "menu"
  41. end
  42.  
  43. function game.pause()
  44.  
  45. end
  46.  
  47. function game.resume(game.s)
  48. love.graphics.setBackgroundColor(26,26,26)
  49. player.draw()
  50. player.step(game.s)
  51. end
  52.  
  53. function game.step(s)
  54. --print(status)
  55. game.time = game.time + s
  56. game.s = s
  57.  
  58. if love.keyboard.isDown("space") then
  59. if not status then
  60. status = "start"
  61. elseif status == "menu" then status = "resume"
  62. end
  63. elseif love.keyboard.isDown("escape") then
  64. if status then
  65. if status ~= "menu" then
  66. status = "stop"
  67. end
  68. end
  69. end
  70. end
  71.  
  72. function drawMainMenu()
  73. love.graphics.setBackgroundColor(26,26,26)
  74. love.graphics.setColor(255,255,255,200)
  75. love.graphics.printf("GENERIC TITLE HERE", 0, height/2 - 120, width, "center")
  76. love.graphics.printf([[
  77. behold you are a flying orb
  78. use keys to move
  79. maths
  80. space inverts ur movement
  81.  
  82.  
  83. press space to begin
  84. ]], 0, height/2 - 40, width, "center")
  85. end
  86.  
  87. function drawGameMenu()
  88. love.graphics.setBackgroundColor(16,16,16)
  89. love.graphics.printf([[paused :)
  90.  
  91. press space to resume
  92. ]], 0, height/2 - 40, width, "center")
  93. end
  94.  
  95. function game.draw()
  96. if not status then
  97. drawMainMenu()
  98. else
  99. game[status]()
  100. end
  101. end
  102.  
  103. return game
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement