Advertisement
Guest User

Cheese Clicker v1

a guest
Nov 6th, 2016
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. clics = 0
  2. objectif = 1000
  3. prixpds = 10
  4. prixsouris = 100
  5. prixcdf = 250
  6. prixmdf = 750
  7. cpc = 1
  8. cps = 0
  9. -- ui.addTextArea(4, "<b>Mine de fromage</b> : " .. prixmdf .. " fromages appuyez sur '4' (pavé numérique) pour en acheter un!", nil, 0, 100)
  10. -- ui.addTextArea(3, "<b>Champs de fromage</b> : " .. prixcdf .. " fromages appuyez sur '3' (pavé numérique) pour en acheter un!", nil, 0, 75)
  11. -- ui.addTextArea(2, "<b>Souris</b> : " .. prixsouris .. " fromages appuyez sur '2' (pavé numérique) pour en acheter un!", nil, 0, 50)
  12. -- ui.addTextArea(1, "<b>Pointeur de Souris</b> : " .. prixpds .. " fromages appuyez sur '1' (pavé numérique) pour en acheter un!", nil, 0, 25)
  13. fromage = 0
  14. function eventLoop(currentTime, timeRemaining)
  15. prixpds = math.floor(prixpds)
  16. prixsouris = math.floor(prixsouris)
  17. prixcdf = math.floor(prixcdf)
  18. prixmdf = math.floor(prixmdf)
  19. print(cps)
  20. if objectif <= fromage then
  21. cps = cps + objectif / 100
  22. objectif = objectif * 1.5
  23. end
  24. ui.setMapName ("</b>• Fromages :<b> " .. fromage .. "</b>/" .. objectif .. "<n> <g>|</g></n> <j></fc></b><n>Totals de clics : <b>" .. clics .. "</b> <g>|</g> CPS : <b>".. cps .. "</b> <g>|</g> CPC : <b>".. cpc .. "</b>")
  25. fromage = fromage + cps / 2
  26. ui.addTextArea(4, "<b>Mine de fromage</b> : " .. prixmdf .. " fromages appuyez sur '4' (pavé numérique) pour en acheter un!", nil, 0, 100)
  27. ui.addTextArea(3, "<b>Champs de fromage</b> : " .. prixcdf .. " fromages appuyez sur '3' (pavé numérique) pour en acheter un!", nil, 0, 75)
  28. ui.addTextArea(2, "<b>Souris</b> : " .. prixsouris .. " fromages appuyez sur '2' (pavé numérique) pour en acheter un!", nil, 0, 50)
  29. ui.addTextArea(1, "<b>Pointeur de Souris</b> : " .. prixpds .. " fromages appuyez sur '1' (pavé numérique) pour en acheter un!", nil, 0, 25)
  30. end
  31.  
  32. ui.addTextArea(0, "Cliquez <a href='event:clic1'>ici</a>!", nil, 350, 200)
  33.  
  34. function eventTextAreaCallback(textAreaId, playerName, callback)
  35. print(playerName .. " clicked")
  36. fromage = fromage + cpc
  37. clics = clics + 1
  38. tfm.exec.setPlayerScore (playerName, 1, true)
  39. end
  40.  
  41. function eventChatCommand(pseudo, message)
  42. if message:sub(0,4) == "help" then
  43. if message:sub(6) ~= "" then
  44. else
  45. ui.addPopup(0, 0, "Bienvenue sur <b>Cheese Clicker</b>!<br>Ton objectif seras de cliquer sur le rectangle au milieu (et plus précisement sur le 'ici'!<br>Tu feras gagnerais des Fromages à tout le monde, ces fromages peuvent être échanger contre des améliorations!", pseudo, 250, 150, 300)
  46. end
  47. end
  48. end
  49.  
  50. function eventKeyboard(playerName, keyCode, down, xPlayerPosition, yPlayerPosition)
  51. if(keyCode == 97) then
  52. print(playerName .. " à essayé d'achéter Pointeur de souris.")
  53. if fromage >= prixpds then
  54. print(playerName .. " à achété Pointeur de Souris.")
  55. fromage = fromage - prixpds
  56. cpc = cpc + 0.1
  57. prixpds = prixpds * 1.2
  58. end
  59. end
  60.  
  61. if(keyCode == 98) then
  62. print(playerName .. " à essayé d'achéter Souris.")
  63. if fromage >= prixsouris then
  64. print(playerName .. " à achété Souris.")
  65. fromage = fromage - prixsouris
  66. cps = cps + 1
  67. prixsouris = prixsouris * 1.1
  68. end
  69. end
  70.  
  71. if(keyCode == 99) then
  72. print(playerName .. " à essayé d'achéter Ferme.")
  73. if fromage >= prixcdf then
  74. print(playerName .. " à achété Ferme.")
  75. fromage = fromage - prixcdf
  76. cps = cps + 4
  77. prixsouris = prixcdf * 1.1
  78. end
  79. end
  80. end
  81.  
  82.  
  83. for playerName in pairs(tfm.get.room.playerList) do
  84. tfm.exec.bindKeyboard(playerName, 97, true, true) -- on écoute l'évènement "touche espace pressée"
  85. tfm.exec.bindKeyboard(playerName, 98, true, true) -- on écoute l'évènement "touche espace pressée"
  86. tfm.exec.bindKeyboard(playerName, 99, true, true) -- on écoute l'évènement "touche espace pressée"
  87. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement