Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

level3.lua 1.8 KiB

3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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, planetImage, "nodelete"))
  35. table.insert(planets, planet(700, 300, 50, 0.3, planetImage, "nodelete"))
  36. table.insert(planets, planet(900, 200, 50, 0.3, planetImage, "nodelete"))
  37. end
  38. function level3.reset()
  39. firstShip:reset()
  40. for k in pairs(planets) do
  41. if planets[k].deletable then
  42. planets[k] = nil
  43. end
  44. end
  45. local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
  46. shipsleft = 1
  47. firstShip.fuel = 75
  48. shipIsHit = false
  49. planetsleft = 3
  50. end
  51. function level3.GUIControl()
  52. if (love.keyboard.isDown('a') and VCAM.x > WINDOW_WIDTH/2) then
  53. VCAM.x = VCAM.x - 10
  54. end
  55. if (love.keyboard.isDown('d')) then
  56. VCAM.x = VCAM.x + 10
  57. end
  58. end
  59. function level3.goBack()
  60. levelgeneral.goBack()
  61. end
  62. return level3