Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

65 righe
1.8 KiB

  1. level3 = Class{}
  2. local levelLoaded = false
  3. local M = {}
  4. function level3.load()
  5. shipsleft = 1
  6. local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
  7. planetsleft = 3
  8. gameStatus = "setup"
  9. playbutts = {}
  10. thrusterMax = 150
  11. firstShip.fuel = 150
  12. guibutts = {}
  13. VCAM.x, VCAM.y = WINDOW_WIDTH/2, WINDOW_HEIGHT/2
  14. explosions = {}
  15. shipIsHit = false
  16. guimenu = mainMenu()
  17. reachedGoal = false
  18. lvlbase = base(900, 300)
  19. levelLoaded = true
  20. table.insert(playbutts, menu:addButton("Return to setup", function()
  21. gameStatus = "setup"
  22. levelgeneral.reset()
  23. end ))
  24. table.insert(guibutts, menu:addButton("Release brake!", function ()
  25. if shipsleft == 0 then
  26. selectedItem = "none"
  27. gameStatus = "play"
  28. end
  29. end
  30. ))
  31. table.insert(guibutts, menu:addButton("To menu", function ()
  32. levelgeneral.goBack()
  33. end))
  34. table.insert(planets, planet(900, 400, 50, 0.3, planetImage, "nodelete"))
  35. table.insert(planets, planet(700, 300, 50, 0.3, planetImage, "nodelete"))
  36. table.insert(planets, planet(900, 200, 50, 0.3, planetImage, "nodelete"))
  37. end
  38. function level3.reset()
  39. firstShip:reset()
  40. for k in pairs(planets) do
  41. if planets[k].deletable then
  42. planets[k] = nil
  43. end
  44. end
  45. local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
  46. shipsleft = 1
  47. firstShip.fuel = 150
  48. shipIsHit = false
  49. planetsleft = 3
  50. end
  51. function level3.GUIControl()
  52. if (love.keyboard.isDown('a') and VCAM.x > WINDOW_WIDTH/2) then
  53. VCAM.x = VCAM.x - 10
  54. end
  55. if (love.keyboard.isDown('d')) then
  56. VCAM.x = VCAM.x + 10
  57. end
  58. end
  59. function level3.goBack()
  60. levelgeneral.goBack()
  61. end
  62. return level3