Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

59 linhas
1.7 KiB

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