You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.0 KiB

  1. gameState = "menu"
  2. animationSecsLeft = 3
  3. require 'src/dependencies'
  4. math.randomseed(os.time())
  5. --VARIABLES
  6. RESOLUTION_SET = 0
  7. isFullscreen = 0
  8. DIFFERENCE_X = 1
  9. DIFFERENCE_Y = 1
  10. WINDOW_WIDTH = 1280
  11. WINDOW_HEIGHT = 720
  12. OFFSET_X = 0
  13. OFFSET_Y = 0
  14. currentLevel = 0
  15. saveData = {
  16. levelsBeaten = 0,
  17. score = 0
  18. }
  19. planets = {}
  20. buttons = {}
  21. cannons = {}
  22. projectiles = {}
  23. menu = mainMenu()
  24. function love.load()
  25. print(love.filesystem.getAppdataDirectory())
  26. print(love.filesystem.getSaveDirectory())
  27. print(love.filesystem.areSymlinksEnabled())
  28. print(love.filesystem.createDirectory('.'))
  29. love.filesystem.newFile("File")
  30. testwalls = love.filesystem.load("save")
  31. if testwalls ~= nil then
  32. saveData = love.filesystem.load("save")()
  33. --print("Save file found")
  34. else
  35. --print("No save file found!")
  36. end
  37. if saveData.score == nil then
  38. saveData.score = 0
  39. end
  40. tick.framerate = 60
  41. camera = Camera()
  42. BG = love.graphics.newImage("entities/background.jpg")
  43. logo = love.graphics.newImage("logo.png")
  44. simpleScale.setWindow(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT)
  45. firstShip = ship(-500, -500, "entities/ship/smol_white_01.png")
  46. VCAM = VCAM(WINDOW_WIDTH/2, WINDOW_HEIGHT/2)
  47. tinyfont = love.graphics.newFont("font.ttf", 15)
  48. smallfont = love.graphics.newFont("font.ttf", 25)
  49. titlefont = love.graphics.newFont("font.ttf", 50)
  50. myscreen = fullScreener(RESOLUTION_SET, isFullscreen, DIFFERENCE_X, DIFFERENCE_Y, OFFSET_X, OFFSET_Y)
  51. --table.insert(planets, planet(100, WINDOW_HEIGHT/2-100, 1010000000, 1))
  52. buttonClutter()
  53. --planet2 = planet(1000, 300, 1000000000, 20)
  54. end
  55. function love.update(dt)
  56. stateUpdate(dt)
  57. love.window.setTitle("Nuclear Gravity")
  58. end
  59. function love.draw()
  60. simpleScale.set()
  61. love.graphics.clear(30 / 255,30 / 255,30 / 255,1)
  62. stateDraw()
  63. simpleScale.unSet()
  64. end
  65. function love.mousereleased(x, y, button)
  66. love.keyboard.mouseisReleased = true
  67. end
  68. function objReset()
  69. firstShip:reset()
  70. planets = {}
  71. end