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.

level3.lua 2.2 KiB

3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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, asteroidImage, "nodelete"))
  35. table.insert(planets, planet(700, 300, 50, 0.3, asteroidImage, "nodelete"))
  36. table.insert(planets, planet(900, 200, 50, 0.3, asteroidImage, "nodelete"))
  37. end
  38. function level3.hint()
  39. GUIDraw("left")
  40. love.graphics.setFont(tinyfont)
  41. if (VCAM.x > WINDOW_WIDTH/2) then
  42. if love.keyboard.isDown('a') then
  43. love.graphics.setColor(1,0,0,1)
  44. end
  45. love.graphics.print("←[A]",10,50)
  46. love.graphics.setColor(1,1,1,1)
  47. end
  48. if (VCAM.x < WINDOW_WIDTH*2) then
  49. if love.keyboard.isDown('a') then
  50. love.graphics.setColor(1,0,0,1)
  51. end
  52. love.graphics.print("[D]→",100,50)
  53. love.graphics.setColor(1,1,1,1)
  54. end
  55. end
  56. function level3.reset()
  57. firstShip:reset()
  58. local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
  59. shipsleft = 1
  60. firstShip.fuel = 75
  61. shipIsHit = false
  62. end
  63. function level3.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')) then
  68. VCAM.x = VCAM.x + 10
  69. end
  70. end
  71. function level3.goBack()
  72. levelgeneral.goBack()
  73. end
  74. return level3