Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

77 linhas
2.3 KiB

  1. level1 = Class{}
  2. local levelLoaded = false
  3. local M = {}
  4. function level1.load()
  5. shipsleft = 1
  6. thrusterMax = 25
  7. firstShip.fuel = 25
  8. local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
  9. planetsleft = 3
  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(900, 200)
  19. levelLoaded = true
  20. table.insert(playbutts, menu:addButton("Return to setup", function()
  21. gameStatus = "setup"
  22. level1.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. level.goBack()
  33. end))
  34. table.insert(planets, planet(700, 200, 50, 0.3, asteroidImage, "nodelete"))
  35. end
  36. function level1.hint()
  37. GUIDraw("left")
  38. love.graphics.setFont(tinyfont)
  39. love.graphics.setColor(1,1,1,1)
  40. if (VCAM.x > WINDOW_WIDTH/2) then
  41. if love.keyboard.isDown('a') then
  42. love.graphics.setColor(1,0,0,1)
  43. end
  44. love.graphics.print("←[A]",10,50)
  45. love.graphics.setColor(1,1,1,1)
  46. end
  47. if (VCAM.x < WINDOW_WIDTH*2) then
  48. if love.keyboard.isDown('d') then
  49. love.graphics.setColor(1,0,0,1)
  50. end
  51. love.graphics.print("[D]→",100,50)
  52. love.graphics.setColor(1,1,1,1)
  53. end
  54. love.graphics.setColor(1,1,1,1)
  55. end
  56. function level1.reset()
  57. firstShip:reset()
  58. local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
  59. table.insert(planets, planet(700, 200, 50, 0.3, asteroidImage))
  60. shipsleft = 1
  61. shipIsHit = false
  62. firstShip.fuel = 25
  63. end
  64. function level1.GUIControl()
  65. if (love.keyboard.isDown('a') and VCAM.x > WINDOW_WIDTH/2) then
  66. VCAM.x = VCAM.x - 10
  67. end
  68. if (love.keyboard.isDown('d') and VCAM.x < WINDOW_WIDTH*2) then
  69. VCAM.x = VCAM.x + 10
  70. end
  71. end
  72. function level1.goBack()
  73. levelgeneral.goBack()
  74. end
  75. return level1