25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.7 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. 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(900, 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 level3.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 level3.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 level3