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

level3.lua 2.4 KiB

3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
3 년 전
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 = 75
  11. firstShip.fuel = 75
  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, asteroidImage, "nodelete"))
  35. table.insert(planets, planet(700, 300, 50, 0.3, asteroidImage, "nodelete"))
  36. table.insert(planets, planet(900, 200, 50, 0.3, asteroidImage, "nodelete"))
  37. end
  38. function level3.hint()
  39. GUIDraw("left")
  40. love.graphics.setFont(tinyfont)
  41. if (VCAM.x > WINDOW_WIDTH/2) then
  42. if love.keyboard.isDown('a') then
  43. love.graphics.setColor(1,0,0,1)
  44. end
  45. love.graphics.print("←[A]",10,50)
  46. love.graphics.setColor(1,1,1,1)
  47. end
  48. if (VCAM.x < WINDOW_WIDTH*2) then
  49. if love.keyboard.isDown('a') then
  50. love.graphics.setColor(1,0,0,1)
  51. end
  52. love.graphics.print("[D]→",100,50)
  53. love.graphics.setColor(1,1,1,1)
  54. end
  55. end
  56. function level3.reset()
  57. firstShip:reset()
  58. for k in pairs(planets) do
  59. if planets[k].deletable then
  60. planets[k] = nil
  61. end
  62. end
  63. local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
  64. shipsleft = 1
  65. firstShip.fuel = 75
  66. shipIsHit = false
  67. planetsleft = 3
  68. end
  69. function level3.GUIControl()
  70. if (love.keyboard.isDown('a') and VCAM.x > WINDOW_WIDTH/2) then
  71. VCAM.x = VCAM.x - 10
  72. end
  73. if (love.keyboard.isDown('d')) then
  74. VCAM.x = VCAM.x + 10
  75. end
  76. end
  77. function level3.goBack()
  78. levelgeneral.goBack()
  79. end
  80. return level3