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 година
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. firstShip.fuel = 100
  13. VCAM.x, VCAM.y = 0, WINDOW_HEIGHT/2
  14. explosions = {}
  15. shipIsHit = false
  16. guimenu = mainMenu()
  17. reachedGoal = false
  18. lvlbase = base(50, 2000)
  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(0, 2000, 50, 0.3, asteroidImage, "nodelete"))
  35. table.insert(planets, planet(100, 2000, 50, 0.3, asteroidImage, "nodelete"))
  36. table.insert(planets, planet(50, 1700, 50, 0.3, asteroidImage, "nodelete"))
  37. end
  38. function level5.reset()
  39. firstShip:reset()
  40. local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
  41. shipsleft = 1
  42. firstShip.fuel = 100
  43. shipIsHit = false
  44. end
  45. function level5.GUIControl()
  46. if (love.keyboard.isDown('w') and VCAM.y > -WINDOW_WIDTH) then
  47. VCAM.y = VCAM.y - 10
  48. end
  49. if (love.keyboard.isDown('s') and VCAM.y < WINDOW_WIDTH*2) then
  50. VCAM.y = VCAM.y + 10
  51. end
  52. end
  53. function level5.hint()
  54. GUIDraw("up")
  55. love.graphics.setFont(tinyfont)
  56. if (VCAM.y > -WINDOW_WIDTH) then
  57. if love.keyboard.isDown('w') then
  58. love.graphics.setColor(1,0,0,1)
  59. end
  60. love.graphics.print("↑[W]",50,10)
  61. love.graphics.setColor(1,1,1,1)
  62. end
  63. if (VCAM.y < WINDOW_WIDTH*2) then
  64. if love.keyboard.isDown('s') then
  65. love.graphics.setColor(1,0,0,1)
  66. end
  67. love.graphics.print("↓[S]",50,100)
  68. love.graphics.setColor(1,1,1,1)
  69. end
  70. end
  71. function level5.goBack()
  72. levelgeneral.goBack()
  73. end
  74. return level5