Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

level1.lua 1.8 KiB

il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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, planetImage, "nodelete"))
  35. end
  36. function level1.reset()
  37. firstShip:reset()
  38. for k in pairs(planets) do
  39. planets[k] = nil
  40. end
  41. local planetImage = love.graphics.newImage("entities/planet/planet" .. math.random(1, 18) .. ".png")
  42. table.insert(planets, planet(700, 200, 50, 0.3, planetImage))
  43. shipsleft = 1
  44. shipIsHit = false
  45. firstShip.fuel = 25
  46. planetsleft = 3
  47. end
  48. function level1.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 level1.goBack()
  57. levelgeneral.goBack()
  58. end
  59. return level1