選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

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