You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
3 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. level1 = Class{}
  2. local levelLoaded = false
  3. local M = {}
  4. function level1.load()
  5. shipsleft = 1
  6. thrusterMax = 25
  7. firstShip.fuel = 25
  8. local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
  9. planetsleft = 3
  10. gameStatus = "setup"
  11. playbutts = {}
  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, 200)
  19. levelLoaded = true
  20. table.insert(playbutts, menu:addButton("Return to setup", function()
  21. gameStatus = "setup"
  22. level1.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. level.goBack()
  33. end))
  34. table.insert(planets, planet(700, 200, 50, 0.3, asteroidImage, "nodelete"))
  35. end
  36. function level1.hint()
  37. GUIDraw("left")
  38. love.graphics.setFont(tinyfont)
  39. love.graphics.setColor(1,1,1,1)
  40. if (VCAM.x > WINDOW_WIDTH/2) then
  41. if love.keyboard.isDown('a') then
  42. love.graphics.setColor(1,0,0,1)
  43. end
  44. love.graphics.print("←[A]",10,50)
  45. love.graphics.setColor(1,1,1,1)
  46. end
  47. if (VCAM.x < WINDOW_WIDTH*2) then
  48. if love.keyboard.isDown('d') then
  49. love.graphics.setColor(1,0,0,1)
  50. end
  51. love.graphics.print("[D]→",100,50)
  52. love.graphics.setColor(1,1,1,1)
  53. end
  54. love.graphics.setColor(1,1,1,1)
  55. end
  56. function level1.reset()
  57. firstShip:reset()
  58. local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
  59. shipsleft = 1
  60. shipIsHit = false
  61. firstShip.fuel = 25
  62. end
  63. function level1.GUIControl()
  64. if (love.keyboard.isDown('a') and VCAM.x > WINDOW_WIDTH/2) then
  65. VCAM.x = VCAM.x - 10
  66. end
  67. if (love.keyboard.isDown('d') and VCAM.x < WINDOW_WIDTH*2) then
  68. VCAM.x = VCAM.x + 10
  69. end
  70. end
  71. function level1.goBack()
  72. levelgeneral.goBack()
  73. end
  74. return level1