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 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. level1 = Class{}
  2. local levelLoaded = false
  3. local M = {}
  4. function level1.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. VCAM.x, VCAM.y = WINDOW_WIDTH/2, WINDOW_HEIGHT/2
  12. explosions = {}
  13. shipIsHit = false
  14. guimenu = mainMenu()
  15. reachedGoal = false
  16. lvlbase = base(900, 200)
  17. levelLoaded = true
  18. table.insert(playbutts, menu:addButton("Return to setup", function()
  19. gameStatus = "setup"
  20. level1.reset()
  21. end ))
  22. table.insert(guibutts, menu:addButton("Release brake!", function ()
  23. if shipsleft == 0 then
  24. selectedItem = "none"
  25. gameStatus = "play"
  26. end
  27. end
  28. ))
  29. table.insert(guibutts, menu:addButton("To menu", function ()
  30. level1.goBack()
  31. end))
  32. table.insert(planets, planet(700, 200, 50, 0.3, planetImage, "nodelete"))
  33. end
  34. function level1.reset()
  35. firstShip:reset()
  36. for k in pairs(planets) do
  37. planets[k] = nil
  38. end
  39. local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
  40. table.insert(planets, planet(700, 200, 50, 0.3, planetImage))
  41. shipsleft = 1
  42. shipIsHit = false
  43. planetsleft = 3
  44. end
  45. function level1.GUIControl()
  46. if (love.keyboard.isDown('a') and VCAM.x > WINDOW_WIDTH/2) then
  47. VCAM.x = VCAM.x - 10
  48. end
  49. if (love.keyboard.isDown('d')) then
  50. VCAM.x = VCAM.x + 10
  51. end
  52. end
  53. return level1