Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.69 KB | None | 0 0
  1. io.stdout:setvbuf('no')
  2. love.graphics.setDefaultFilter("nearest")
  3. function love.load()
  4. Tile = {}
  5. Tile.Croix = love.graphics.newImage("Textures/Croix.png")
  6. Tile.Rond = love.graphics.newImage("Textures/Rond.png")
  7. Tile.HG = love.graphics.newImage("Textures/Tile_HG.png")
  8. Tile.HM = love.graphics.newImage("Textures/Tile_HM.png")
  9. Tile.HD = love.graphics.newImage("Textures/Tile_HD.png")
  10. Tile.MG = love.graphics.newImage("Textures/Tile_MG.png")
  11. Tile.MM = love.graphics.newImage("Textures/Tile_MM.png")
  12. Tile.MD = love.graphics.newImage("Textures/Tile_MD.png")
  13. Tile.BG = love.graphics.newImage("Textures/Tile_BG.png")
  14. Tile.BM = love.graphics.newImage("Textures/Tile_BM.png")
  15. Tile.BD = love.graphics.newImage("Textures/Tile_BD.png")
  16. largeur = love.graphics.getWidth()
  17. hauteur = love.graphics.getHeight()
  18. Tile.SCALE = 4
  19. Tile.LARGEUR = 16 * Tile.SCALE
  20. Tile.HAUTEUR = 16 * Tile.SCALE
  21. Tile_MM_X = largeur/2 - Tile.LARGEUR/2
  22. Tile_MM_Y = hauteur/2 - Tile.HAUTEUR/2
  23. Tile_MG_X = Tile_MM_X - Tile.LARGEUR
  24. Tile_MG_Y = Tile_MM_Y
  25. Tile_MD_X = Tile_MM_X + Tile.LARGEUR
  26. Tile_MD_Y = Tile_MM_Y
  27. Tile_HG_X = Tile_MM_X - Tile.LARGEUR
  28. Tile_HG_Y = Tile_MM_Y - Tile.HAUTEUR
  29. Tile_HM_X = Tile_MM_X
  30. Tile_HM_Y = Tile_MM_Y - Tile.HAUTEUR
  31. Tile_HD_X = Tile_MM_X + Tile.LARGEUR
  32. Tile_HD_Y = Tile_MM_Y - Tile.HAUTEUR
  33. Tile_BG_X = Tile_MM_X - Tile.LARGEUR
  34. Tile_BG_Y = Tile_MM_Y + Tile.HAUTEUR
  35. Tile_BM_X = Tile_MM_X
  36. Tile_BM_Y = Tile_MM_Y + Tile.HAUTEUR
  37. Tile_BD_X = Tile_MM_X + Tile.LARGEUR
  38. Tile_BD_Y = Tile_MM_Y + Tile.HAUTEUR
  39. CroixTurn = false
  40. RondTurn = false
  41. CroixMM = false
  42. RondMM = false
  43. CroixMD = false
  44. RondMD = false
  45. CroixMG = false
  46. RondMG = false
  47. CroixHG = false
  48. RondHG = false
  49. CroixHM = false
  50. RondHM = false
  51. CroixHD = false
  52. RondHD = false
  53. CroixBD = false
  54. RondBD = false
  55. CroixBG = false
  56. RondBG = false
  57. CroixBM = false
  58. RondBM = false
  59. JeuxFini = false
  60. Space = false
  61. CroixWin = false
  62. RondWin = false
  63. end
  64. function love.update(dt)
  65. x,y = love.mouse.getPosition()
  66. if love.keyboard.isDown("space") then
  67. CroixTurn = true
  68. end
  69. if CroixTurn == true then
  70. RondTurn = false
  71. elseif RondTurn == true then
  72. CroixTurn = false
  73. end
  74. print(CroixTurn)
  75. print(RondTurn)
  76. if love.keyboard.isDown("escape") then
  77. love.event.quit()
  78. end
  79. if love.keyboard.isDown("space") then
  80. Space = true
  81. end
  82. if CroixWin == true and RondWin == false then
  83. JeuxFini = true
  84. elseif CroixWin == false and RondWin == true then
  85. JeuxFini = true
  86. end
  87. end
  88. function love.draw()
  89. if Space == false then
  90. love.graphics.print("Appuyer sur Espace pour Commencer",285,500)
  91. elseif Space == true then
  92. love.graphics.print("Appuyer sur EntrΓ©e pour recommencer et echap pour quitter",225,500)
  93. end
  94. love.graphics.draw(Tile.MM,Tile_MM_X,Tile_MM_Y,0,Tile.SCALE,Tile.SCALE)
  95. love.graphics.draw(Tile.HG,Tile_HG_X,Tile_HG_Y,0,Tile.SCALE,Tile.SCALE)
  96. love.graphics.draw(Tile.HM,Tile_HM_X,Tile_HM_Y,0,Tile.SCALE,Tile.SCALE)
  97. love.graphics.draw(Tile.HD,Tile_HD_X,Tile_HD_Y,0,Tile.SCALE,Tile.SCALE)
  98. love.graphics.draw(Tile.MG,Tile_MG_X,Tile_MG_Y,0,Tile.SCALE,Tile.SCALE)
  99. love.graphics.draw(Tile.MD,Tile_MD_X,Tile_MD_Y,0,Tile.SCALE,Tile.SCALE)
  100. love.graphics.draw(Tile.BG,Tile_BG_X,Tile_BG_Y,0,Tile.SCALE,Tile.SCALE)
  101. love.graphics.draw(Tile.BM,Tile_BM_X,Tile_BM_Y,0,Tile.SCALE,Tile.SCALE)
  102. love.graphics.draw(Tile.BD,Tile_BD_X,Tile_BD_Y,0,Tile.SCALE,Tile.SCALE)
  103. if JeuxFini == false then
  104. if x >= Tile_MM_X and x <= Tile_MM_X + Tile.LARGEUR and y >= Tile_MM_Y and y <= Tile_MM_Y + Tile.HAUTEUR and CroixTurn == true and RondMM == false and love.mouse.isDown(1) then
  105. CroixMM = true
  106. RondMM = false
  107. CroixTurn = false
  108. RondTurn = true
  109. elseif x >= Tile_MM_X and x <= Tile_MM_X + Tile.LARGEUR and y >= Tile_MM_Y and y <= Tile_MM_Y + Tile.HAUTEUR and RondTurn == true and CroixMM == false and love.mouse.isDown(1) then
  110. RondMM = true
  111. CroixMM = false
  112. CroixTurn = true
  113. RondTurn = false
  114. end
  115. if x >= Tile_MG_X and x <= Tile_MG_X + Tile.LARGEUR and y >= Tile_MG_Y and y <= Tile_MG_Y + Tile.HAUTEUR and CroixTurn == true and RondMG == false and love.mouse.isDown(1) then
  116. CroixMG = true
  117. RondMG = false
  118. CroixTurn = false
  119. RondTurn = true
  120. elseif x >= Tile_MG_X and x <= Tile_MG_X + Tile.LARGEUR and y >= Tile_MG_Y and y <= Tile_MG_Y + Tile.HAUTEUR and RondTurn == true and CroixMG == false and love.mouse.isDown(1) then
  121. RondMG = true
  122. CroixMG = false
  123. CroixTurn = true
  124. RondTurn = false
  125. end
  126. if x >= Tile_MD_X and x <= Tile_MD_X + Tile.LARGEUR and y >= Tile_MD_Y and y <= Tile_MD_Y + Tile.HAUTEUR and CroixTurn == true and RondMD == false and love.mouse.isDown(1) then
  127. CroixMD = true
  128. RondMD = false
  129. CroixTurn = false
  130. RondTurn = true
  131. elseif x >= Tile_MD_X and x <= Tile_MD_X + Tile.LARGEUR and y >= Tile_MD_Y and y <= Tile_MD_Y + Tile.HAUTEUR and RondTurn == true and CroixMD == false and love.mouse.isDown(1) then
  132. RondMD = true
  133. CroixMD = false
  134. CroixTurn = true
  135. RondTurn = false
  136. end
  137. if x >= Tile_HG_X and x <= Tile_HG_X + Tile.LARGEUR and y >= Tile_HG_Y and y <= Tile_HG_Y + Tile.HAUTEUR and CroixTurn == true and RondHG == false and love.mouse.isDown(1) then
  138. CroixHG = true
  139. RondHG = false
  140. CroixTurn = false
  141. RondTurn = true
  142. elseif x >= Tile_HG_X and x <= Tile_HG_X + Tile.LARGEUR and y >= Tile_HG_Y and y <= Tile_HG_Y + Tile.HAUTEUR and RondTurn == true and CroixHG == false and love.mouse.isDown(1) then
  143. RondHG = true
  144. CroixHG = false
  145. CroixTurn = true
  146. RondTurn = false
  147. end
  148. if x >= Tile_HM_X and x <= Tile_HM_X + Tile.LARGEUR and y >= Tile_HM_Y and y <= Tile_HM_Y + Tile.HAUTEUR and CroixTurn == true and RondHM == false and love.mouse.isDown(1) then
  149. CroixHM = true
  150. RondHM = false
  151. CroixTurn = false
  152. RondTurn = true
  153. elseif x >= Tile_HM_X and x <= Tile_HM_X + Tile.LARGEUR and y >= Tile_HM_Y and y <= Tile_HM_Y + Tile.HAUTEUR and RondTurn == true and CroixHM == false and love.mouse.isDown(1) then
  154. CroixHM = false
  155. RondHM = true
  156. CroixTurn = true
  157. RondTurn = false
  158. end
  159. if x >= Tile_HD_X and x <= Tile_HD_X + Tile.LARGEUR and y >= Tile_HD_Y and y <= Tile_HD_Y + Tile.HAUTEUR and CroixTurn == true and RondHD == false and love.mouse.isDown(1) then
  160. CroixHD = true
  161. RondHD = false
  162. CroixTurn = false
  163. RondTurn = true
  164. elseif x >= Tile_HD_X and x <= Tile_HD_X + Tile.LARGEUR and y >= Tile_HD_Y and y <= Tile_HD_Y + Tile.HAUTEUR and RondTurn == true and CroixHD == false and love.mouse.isDown(1) then
  165. CroixHD = false
  166. RondHD = true
  167. CroixTurn = true
  168. RondTurn = false
  169. end
  170. if x >= Tile_BG_X and x <= Tile_BG_X + Tile.LARGEUR and y >= Tile_BG_Y and y <= Tile_BG_Y + Tile.HAUTEUR and CroixTurn == true and RondBG == false and love.mouse.isDown(1) then
  171. CroixBG = true
  172. RondBG = false
  173. CroixTurn = false
  174. RondTurn = true
  175. elseif x >= Tile_BG_X and x <= Tile_BG_X + Tile.LARGEUR and y >= Tile_BG_Y and y <= Tile_BG_Y + Tile.HAUTEUR and RondTurn == true and CroixBG == false and love.mouse.isDown(1) then
  176. CroixBG = false
  177. RondBG = true
  178. CroixTurn = true
  179. RondTurn = false
  180. end
  181. if x >= Tile_BM_X and x <= Tile_BM_X + Tile.LARGEUR and y >= Tile_BM_Y and y <= Tile_BM_Y + Tile.HAUTEUR and CroixTurn == true and RondBM == false and love.mouse.isDown(1) then
  182. CroixBM = true
  183. RondBM = false
  184. CroixTurn = false
  185. RondTurn = true
  186. elseif x >= Tile_BM_X and x <= Tile_BM_X + Tile.LARGEUR and y >= Tile_BM_Y and y <= Tile_BM_Y + Tile.HAUTEUR and RondTurn == true and CroixBM == false and love.mouse.isDown(1) then
  187. CroixBM = false
  188. RondBM = true
  189. CroixTurn = true
  190. RondTurn = false
  191. end
  192. if x >= Tile_BD_X and x <= Tile_BD_X + Tile.LARGEUR and y >= Tile_BD_Y and y <= Tile_BD_Y + Tile.HAUTEUR and CroixTurn == true and RondBD == false and love.mouse.isDown(1) then
  193. CroixBD = true
  194. RondBD = false
  195. CroixTurn = false
  196. RondTurn = true
  197. elseif x >= Tile_BD_X and x <= Tile_BD_X + Tile.LARGEUR and y >= Tile_BD_Y and y <= Tile_BD_Y + Tile.HAUTEUR and RondTurn == true and CroixBD == false and love.mouse.isDown(1) then
  198. CroixBD = false
  199. RondBD = true
  200. CroixTurn = true
  201. RondTurn = false
  202. end
  203. end
  204. if CroixMM == true then
  205. love.graphics.draw(Tile.Croix,Tile_MM_X,Tile_MM_Y,0,Tile.SCALE,Tile.SCALE)
  206. elseif RondMM == true then
  207. love.graphics.draw(Tile.Rond,Tile_MM_X,Tile_MM_Y,0,Tile.SCALE,Tile.SCALE)
  208. end
  209. if CroixMG == true then
  210. love.graphics.draw(Tile.Croix,Tile_MG_X,Tile_MG_Y,0,Tile.SCALE,Tile.SCALE)
  211. elseif RondMG == true then
  212. love.graphics.draw(Tile.Rond,Tile_MG_X,Tile_MG_Y,0,Tile.SCALE,Tile.SCALE)
  213. end
  214. if CroixMD == true then
  215. love.graphics.draw(Tile.Croix,Tile_MD_X,Tile_MD_Y,0,Tile.SCALE,Tile.SCALE)
  216. elseif RondMD == true then
  217. love.graphics.draw(Tile.Rond,Tile_MD_X,Tile_MD_Y,0,Tile.SCALE,Tile.SCALE)
  218. end
  219. if CroixHG == true then
  220. love.graphics.draw(Tile.Croix,Tile_HG_X,Tile_HG_Y,0,Tile.SCALE,Tile.SCALE)
  221. elseif RondHG == true then
  222. love.graphics.draw(Tile.Rond,Tile_HG_X,Tile_HG_Y,0,Tile.SCALE,Tile.SCALE)
  223. end
  224. if CroixHM == true then
  225. love.graphics.draw(Tile.Croix,Tile_HM_X,Tile_HM_Y,0,Tile.SCALE,Tile.SCALE)
  226. elseif RondHM == true then
  227. love.graphics.draw(Tile.Rond,Tile_HM_X,Tile_HM_Y,0,Tile.SCALE,Tile.SCALE)
  228. end
  229. if CroixHD == true then
  230. love.graphics.draw(Tile.Croix,Tile_HD_X,Tile_HG_Y,0,Tile.SCALE,Tile.SCALE)
  231. elseif RondHD == true then
  232. love.graphics.draw(Tile.Rond,Tile_HD_X,Tile_HG_Y,0,Tile.SCALE,Tile.SCALE)
  233. end
  234. if CroixBG == true then
  235. love.graphics.draw(Tile.Croix,Tile_BG_X,Tile_BG_Y,0,Tile.SCALE,Tile.SCALE)
  236. elseif RondBG == true then
  237. love.graphics.draw(Tile.Rond,Tile_BG_X,Tile_BG_Y,0,Tile.SCALE,Tile.SCALE)
  238. end
  239. if CroixBM == true then
  240. love.graphics.draw(Tile.Croix,Tile_BM_X,Tile_BM_Y,0,Tile.SCALE,Tile.SCALE)
  241. elseif RondBM == true then
  242. love.graphics.draw(Tile.Rond,Tile_BM_X,Tile_BM_Y,0,Tile.SCALE,Tile.SCALE)
  243. end
  244. if CroixBD == true then
  245. love.graphics.draw(Tile.Croix,Tile_BD_X,Tile_BD_Y,0,Tile.SCALE,Tile.SCALE)
  246. elseif RondBD == true then
  247. love.graphics.draw(Tile.Rond,Tile_BD_X,Tile_BD_Y,0,Tile.SCALE,Tile.SCALE)
  248. end
  249. if CroixHD == true and CroixHM == true and CroixHG == true then
  250. love.graphics.setColor(1,0,0)
  251. love.graphics.line(Tile_HG_X,Tile_HG_Y + Tile.HAUTEUR/2,Tile_HD_X + Tile.LARGEUR,Tile_HD_Y + Tile.HAUTEUR/2)
  252. love.graphics.print("CROIX WIN",375,100)
  253. love.graphics.setColor(1,1,1)
  254. CroixWin = true
  255. RonWin = false
  256. elseif RondHG == true and RondHM == true and RondHD == true then
  257. love.graphics.setColor(0,0,1)
  258. love.graphics.line(Tile_HG_X,Tile_HG_Y + Tile.HAUTEUR/2,Tile_HD_X + Tile.LARGEUR,Tile_HD_Y + Tile.HAUTEUR/2)
  259. love.graphics.print("ROND WIN",375,100)
  260. love.graphics.setColor(1,1,1)
  261. RonWin = true
  262. CroixWin = false
  263. end
  264. if CroixMD == true and CroixMM == true and CroixMG == true then
  265. love.graphics.setColor(1,0,0)
  266. love.graphics.line(Tile_MG_X,Tile_MG_Y + Tile.HAUTEUR/2,Tile_MD_X + Tile.LARGEUR,Tile_MD_Y + Tile.HAUTEUR/2)
  267. love.graphics.print("CROIX WIN",375,100)
  268. love.graphics.setColor(1,1,1)
  269. CroixWin = true
  270. RonWin = false
  271. elseif RondMG == true and RondMM == true and RondMD == true then
  272. love.graphics.setColor(0,0,1)
  273. love.graphics.line(Tile_MG_X,Tile_MG_Y + Tile.HAUTEUR/2,Tile_MD_X + Tile.LARGEUR,Tile_MD_Y + Tile.HAUTEUR/2)
  274. love.graphics.print("ROND WIN",375,100)
  275. love.graphics.setColor(1,1,1)
  276. RonWin = true
  277. CroixWin = false
  278. end
  279. if CroixBD == true and CroixBM == true and CroixBG == true then
  280. love.graphics.setColor(1,0,0)
  281. love.graphics.line(Tile_BG_X,Tile_BG_Y + Tile.HAUTEUR/2,Tile_BD_X + Tile.LARGEUR,Tile_BD_Y + Tile.HAUTEUR/2)
  282. love.graphics.print("CROIX WIN",375,100)
  283. love.graphics.setColor(1,1,1)
  284. CroixWin = true
  285. RonWin = false
  286. elseif RondBG == true and RondBM == true and RondBD == true then
  287. love.graphics.setColor(0,0,1)
  288. love.graphics.line(Tile_BG_X,Tile_BG_Y + Tile.HAUTEUR/2,Tile_BD_X + Tile.LARGEUR,Tile_BD_Y + Tile.HAUTEUR/2)
  289. love.graphics.print("ROND WIN",375,100)
  290. love.graphics.setColor(1,1,1)
  291. RonWin = true
  292. CroixWin = false
  293. end
  294. if CroixHD == true and CroixMD == true and CroixBD == true then
  295. love.graphics.setColor(1,0,0)
  296. love.graphics.line(Tile_HD_X + Tile.LARGEUR/2,Tile_HD_Y ,Tile_BD_X + Tile.LARGEUR/2,Tile_BD_Y + Tile.LARGEUR)
  297. love.graphics.print("CROIX WIN",375,100)
  298. love.graphics.setColor(1,1,1)
  299. CroixWin = true
  300. RonWin = false
  301. elseif RondHD == true and RondMD == true and RondBD == true then
  302. love.graphics.setColor(0,0,1)
  303. love.graphics.line(Tile_HD_X + Tile.LARGEUR/2,Tile_HD_Y ,Tile_BD_X + Tile.LARGEUR/2,Tile_BD_Y + Tile.LARGEUR)
  304. love.graphics.print("ROND WIN",375,100)
  305. love.graphics.setColor(1,1,1)
  306. RonWin = true
  307. CroixWin = false
  308. end
  309. if CroixHG == true and CroixMG == true and CroixBG == true then
  310. love.graphics.setColor(1,0,0)
  311. love.graphics.line(Tile_HG_X + Tile.LARGEUR/2,Tile_HG_Y ,Tile_BG_X + Tile.LARGEUR/2,Tile_BG_Y + Tile.LARGEUR)
  312. love.graphics.print("CROIX WIN",375,100)
  313. love.graphics.setColor(1,1,1)
  314. CroixWin = true
  315. RonWin = false
  316. elseif RondHG == true and RondMG == true and RondBG == true then
  317. love.graphics.setColor(0,0,1)
  318. love.graphics.line(Tile_HG_X + Tile.LARGEUR/2,Tile_HG_Y ,Tile_BG_X + Tile.LARGEUR/2,Tile_BG_Y + Tile.LARGEUR)
  319. love.graphics.print("ROND WIN",375,100)
  320. love.graphics.setColor(1,1,1)
  321. RonWin = true
  322. CroixWin = false
  323. end
  324. if CroixHM == true and CroixMM == true and CroixBM == true then
  325. love.graphics.setColor(1,0,0)
  326. love.graphics.line(Tile_HM_X + Tile.LARGEUR/2,Tile_HM_Y ,Tile_BM_X + Tile.LARGEUR/2,Tile_BM_Y + Tile.LARGEUR)
  327. love.graphics.print("CROIX WIN",375,100)
  328. love.graphics.setColor(1,1,1)
  329. CroixWin = true
  330. RonWin = false
  331. elseif RondHM == true and RondMM == true and RondBM == true then
  332. love.graphics.setColor(0,0,1)
  333. love.graphics.line(Tile_HM_X + Tile.LARGEUR/2,Tile_HM_Y ,Tile_BM_X + Tile.LARGEUR/2,Tile_BM_Y + Tile.LARGEUR)
  334. love.graphics.print("ROND WIN",375,100)
  335. love.graphics.setColor(1,1,1)
  336. RonWin = true
  337. CroixWin = false
  338. end
  339. if CroixHG == true and CroixMM == true and CroixBD == true then
  340. love.graphics.setColor(1,0,0)
  341. love.graphics.line(Tile_HG_X+ Tile.LARGEUR/2,Tile_HG_Y+ Tile.LARGEUR/2,Tile_BD_X + Tile.LARGEUR/2,Tile_BD_Y + Tile.LARGEUR/2)
  342. love.graphics.print("CROIX WIN",375,100)
  343. love.graphics.setColor(1,1,1)
  344. CroixWin = true
  345. RonWin = false
  346. elseif RondHG == true and RondMM == true and RondBD == true then
  347. love.graphics.setColor(0,0,1)
  348. love.graphics.line(Tile_HG_X+ Tile.LARGEUR/2,Tile_HG_Y+ Tile.LARGEUR/2,Tile_BD_X + Tile.LARGEUR/2,Tile_BD_Y + Tile.LARGEUR/2)
  349. love.graphics.print("ROND WIN",375,100)
  350. love.graphics.setColor(1,1,1)
  351. RonWin = true
  352. CroixWin = false
  353. end
  354. if CroixHD == true and CroixMM == true and CroixBG == true then
  355. love.graphics.setColor(1,0,0)
  356. love.graphics.line(Tile_HD_X+ Tile.LARGEUR/2,Tile_HD_Y+ Tile.LARGEUR/2,Tile_BG_X + Tile.LARGEUR/2,Tile_BG_Y + Tile.LARGEUR/2)
  357. love.graphics.print("CROIX WIN",375,100)
  358. love.graphics.setColor(1,1,1)
  359. CroixWin = true
  360. RonWin = false
  361. elseif RondHD == true and RondMM == true and RondBG == true then
  362. love.graphics.setColor(0,0,1)
  363. love.graphics.line(Tile_HD_X+ Tile.LARGEUR/2,Tile_HD_Y+ Tile.LARGEUR/2,Tile_BG_X + Tile.LARGEUR/2,Tile_BG_Y + Tile.LARGEUR/2)
  364. love.graphics.print("ROND WIN",375,100)
  365. love.graphics.setColor(1,1,1)
  366. RonWin = true
  367. CroixWin = false
  368. end
  369. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement