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

level5.lua 2.3 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. level5 = Class{}
  2. local levelLoaded = false
  3. local M = {}
  4. function level5.load()
  5. shipsleft = 1
  6. local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
  7. planetsleft = 10
  8. gameStatus = "setup"
  9. playbutts = {}
  10. guibutts = {}
  11. thrusterMax = 100
  12. cameraControl = true
  13. firstShip.fuel = 100
  14. VCAM.x, VCAM.y = 0, WINDOW_HEIGHT/2
  15. explosions = {}
  16. shipIsHit = false
  17. guimenu = mainMenu()
  18. reachedGoal = false
  19. lvlbase = base(50, 2000)
  20. levelLoaded = true
  21. table.insert(playbutts, menu:addButton("Return to setup", function()
  22. gameStatus = "setup"
  23. levelgeneral.reset()
  24. end ))
  25. table.insert(guibutts, menu:addButton("Release brake!", function ()
  26. if shipsleft == 0 then
  27. selectedItem = "none"
  28. gameStatus = "play"
  29. end
  30. end
  31. ))
  32. table.insert(guibutts, menu:addButton("To menu", function ()
  33. levelgeneral.goBack()
  34. end))
  35. table.insert(planets, planet(-100, 2000, 50, 0.3, asteroidImage, "nodelete"))
  36. table.insert(planets, planet(200, 2000, 50, 0.3, asteroidImage, "nodelete"))
  37. table.insert(planets, planet(50, 1700, 50, 0.3, asteroidImage, "nodelete"))
  38. end
  39. function level5.reset()
  40. firstShip:reset()
  41. local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
  42. shipsleft = 1
  43. firstShip.fuel = 100
  44. shipIsHit = false
  45. end
  46. function level5.GUIControl()
  47. if (love.keyboard.isDown('w') and VCAM.y > -WINDOW_WIDTH) then
  48. VCAM.y = VCAM.y - 10
  49. end
  50. if (love.keyboard.isDown('s') and VCAM.y < WINDOW_WIDTH*2) then
  51. VCAM.y = VCAM.y + 10
  52. end
  53. end
  54. function level5.hint()
  55. GUIDraw("up")
  56. love.graphics.setFont(tinyfont)
  57. if (VCAM.y > -WINDOW_WIDTH) then
  58. if love.keyboard.isDown('w') then
  59. love.graphics.setColor(1,0,0,1)
  60. end
  61. love.graphics.print("↑[W]",50,10)
  62. love.graphics.setColor(1,1,1,1)
  63. end
  64. if (VCAM.y < WINDOW_WIDTH*2) then
  65. if love.keyboard.isDown('s') then
  66. love.graphics.setColor(1,0,0,1)
  67. end
  68. love.graphics.print("↓[S]",50,100)
  69. love.graphics.setColor(1,1,1,1)
  70. end
  71. end
  72. function level5.goBack()
  73. levelgeneral.goBack()
  74. end
  75. return level5