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.

level2.lua 1.7 KiB

3 vuotta sitten
3 vuotta sitten
3 vuotta sitten
3 vuotta sitten
3 vuotta sitten
3 vuotta sitten
3 vuotta sitten
3 vuotta sitten
3 vuotta sitten
3 vuotta sitten
3 vuotta sitten
3 vuotta sitten
3 vuotta sitten
3 vuotta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. level2 = Class{}
  2. local levelLoaded = false
  3. local M = {}
  4. function level2.load()
  5. shipsleft = 1
  6. local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
  7. planetsleft = 3
  8. thrusterMax = 50
  9. firstShip.fuel = 50
  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(1800, 500)
  19. levelLoaded = true
  20. table.insert(playbutts, menu:addButton("Return to setup", function()
  21. gameStatus = "setup"
  22. level2.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. level2.goBack()
  33. end))
  34. table.insert(planets, planet(700, 500, 50, 0.3, planetImage, "nodelete"))
  35. end
  36. function level2.reset()
  37. firstShip:reset()
  38. for k in pairs(planets) do
  39. planets[k] = nil
  40. end
  41. firstShip.fuel = 50
  42. local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
  43. table.insert(planets, planet(700, 500, 50, 0.3, planetImage))
  44. shipsleft = 1
  45. shipIsHit = false
  46. planetsleft = 3
  47. end
  48. function level2.GUIControl()
  49. if (love.keyboard.isDown('a') and VCAM.x > WINDOW_WIDTH/2) then
  50. VCAM.x = VCAM.x - 10
  51. end
  52. if (love.keyboard.isDown('d')) then
  53. VCAM.x = VCAM.x + 10
  54. end
  55. end
  56. function level2.goBack()
  57. levelgeneral.goBack()
  58. end
  59. return level2