Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- io.stdout:setvbuf('no')
- love.graphics.setDefaultFilter("nearest")
- function love.load()
- Tile = {}
- Tile.Croix = love.graphics.newImage("Textures/Croix.png")
- Tile.Rond = love.graphics.newImage("Textures/Rond.png")
- Tile.HG = love.graphics.newImage("Textures/Tile_HG.png")
- Tile.HM = love.graphics.newImage("Textures/Tile_HM.png")
- Tile.HD = love.graphics.newImage("Textures/Tile_HD.png")
- Tile.MG = love.graphics.newImage("Textures/Tile_MG.png")
- Tile.MM = love.graphics.newImage("Textures/Tile_MM.png")
- Tile.MD = love.graphics.newImage("Textures/Tile_MD.png")
- Tile.BG = love.graphics.newImage("Textures/Tile_BG.png")
- Tile.BM = love.graphics.newImage("Textures/Tile_BM.png")
- Tile.BD = love.graphics.newImage("Textures/Tile_BD.png")
- largeur = love.graphics.getWidth()
- hauteur = love.graphics.getHeight()
- Tile.SCALE = 4
- Tile.LARGEUR = 16 * Tile.SCALE
- Tile.HAUTEUR = 16 * Tile.SCALE
- Tile_MM_X = largeur/2 - Tile.LARGEUR/2
- Tile_MM_Y = hauteur/2 - Tile.HAUTEUR/2
- Tile_MG_X = Tile_MM_X - Tile.LARGEUR
- Tile_MG_Y = Tile_MM_Y
- Tile_MD_X = Tile_MM_X + Tile.LARGEUR
- Tile_MD_Y = Tile_MM_Y
- Tile_HG_X = Tile_MM_X - Tile.LARGEUR
- Tile_HG_Y = Tile_MM_Y - Tile.HAUTEUR
- Tile_HM_X = Tile_MM_X
- Tile_HM_Y = Tile_MM_Y - Tile.HAUTEUR
- Tile_HD_X = Tile_MM_X + Tile.LARGEUR
- Tile_HD_Y = Tile_MM_Y - Tile.HAUTEUR
- Tile_BG_X = Tile_MM_X - Tile.LARGEUR
- Tile_BG_Y = Tile_MM_Y + Tile.HAUTEUR
- Tile_BM_X = Tile_MM_X
- Tile_BM_Y = Tile_MM_Y + Tile.HAUTEUR
- Tile_BD_X = Tile_MM_X + Tile.LARGEUR
- Tile_BD_Y = Tile_MM_Y + Tile.HAUTEUR
- CroixTurn = false
- RondTurn = false
- CroixMM = false
- RondMM = false
- CroixMD = false
- RondMD = false
- CroixMG = false
- RondMG = false
- CroixHG = false
- RondHG = false
- CroixHM = false
- RondHM = false
- CroixHD = false
- RondHD = false
- CroixBD = false
- RondBD = false
- CroixBG = false
- RondBG = false
- CroixBM = false
- RondBM = false
- JeuxFini = false
- Space = false
- CroixWin = false
- RondWin = false
- end
- function love.update(dt)
- x,y = love.mouse.getPosition()
- if love.keyboard.isDown("space") then
- CroixTurn = true
- end
- if CroixTurn == true then
- RondTurn = false
- elseif RondTurn == true then
- CroixTurn = false
- end
- print(CroixTurn)
- print(RondTurn)
- if love.keyboard.isDown("escape") then
- love.event.quit()
- end
- if love.keyboard.isDown("space") then
- Space = true
- end
- if CroixWin == true and RondWin == false then
- JeuxFini = true
- elseif CroixWin == false and RondWin == true then
- JeuxFini = true
- end
- end
- function love.draw()
- if Space == false then
- love.graphics.print("Appuyer sur Espace pour Commencer",285,500)
- elseif Space == true then
- love.graphics.print("Appuyer sur EntrΓ©e pour recommencer et echap pour quitter",225,500)
- end
- love.graphics.draw(Tile.MM,Tile_MM_X,Tile_MM_Y,0,Tile.SCALE,Tile.SCALE)
- love.graphics.draw(Tile.HG,Tile_HG_X,Tile_HG_Y,0,Tile.SCALE,Tile.SCALE)
- love.graphics.draw(Tile.HM,Tile_HM_X,Tile_HM_Y,0,Tile.SCALE,Tile.SCALE)
- love.graphics.draw(Tile.HD,Tile_HD_X,Tile_HD_Y,0,Tile.SCALE,Tile.SCALE)
- love.graphics.draw(Tile.MG,Tile_MG_X,Tile_MG_Y,0,Tile.SCALE,Tile.SCALE)
- love.graphics.draw(Tile.MD,Tile_MD_X,Tile_MD_Y,0,Tile.SCALE,Tile.SCALE)
- love.graphics.draw(Tile.BG,Tile_BG_X,Tile_BG_Y,0,Tile.SCALE,Tile.SCALE)
- love.graphics.draw(Tile.BM,Tile_BM_X,Tile_BM_Y,0,Tile.SCALE,Tile.SCALE)
- love.graphics.draw(Tile.BD,Tile_BD_X,Tile_BD_Y,0,Tile.SCALE,Tile.SCALE)
- if JeuxFini == false then
- 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
- CroixMM = true
- RondMM = false
- CroixTurn = false
- RondTurn = true
- 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
- RondMM = true
- CroixMM = false
- CroixTurn = true
- RondTurn = false
- end
- 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
- CroixMG = true
- RondMG = false
- CroixTurn = false
- RondTurn = true
- 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
- RondMG = true
- CroixMG = false
- CroixTurn = true
- RondTurn = false
- end
- 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
- CroixMD = true
- RondMD = false
- CroixTurn = false
- RondTurn = true
- 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
- RondMD = true
- CroixMD = false
- CroixTurn = true
- RondTurn = false
- end
- 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
- CroixHG = true
- RondHG = false
- CroixTurn = false
- RondTurn = true
- 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
- RondHG = true
- CroixHG = false
- CroixTurn = true
- RondTurn = false
- end
- 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
- CroixHM = true
- RondHM = false
- CroixTurn = false
- RondTurn = true
- 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
- CroixHM = false
- RondHM = true
- CroixTurn = true
- RondTurn = false
- end
- 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
- CroixHD = true
- RondHD = false
- CroixTurn = false
- RondTurn = true
- 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
- CroixHD = false
- RondHD = true
- CroixTurn = true
- RondTurn = false
- end
- 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
- CroixBG = true
- RondBG = false
- CroixTurn = false
- RondTurn = true
- 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
- CroixBG = false
- RondBG = true
- CroixTurn = true
- RondTurn = false
- end
- 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
- CroixBM = true
- RondBM = false
- CroixTurn = false
- RondTurn = true
- 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
- CroixBM = false
- RondBM = true
- CroixTurn = true
- RondTurn = false
- end
- 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
- CroixBD = true
- RondBD = false
- CroixTurn = false
- RondTurn = true
- 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
- CroixBD = false
- RondBD = true
- CroixTurn = true
- RondTurn = false
- end
- end
- if CroixMM == true then
- love.graphics.draw(Tile.Croix,Tile_MM_X,Tile_MM_Y,0,Tile.SCALE,Tile.SCALE)
- elseif RondMM == true then
- love.graphics.draw(Tile.Rond,Tile_MM_X,Tile_MM_Y,0,Tile.SCALE,Tile.SCALE)
- end
- if CroixMG == true then
- love.graphics.draw(Tile.Croix,Tile_MG_X,Tile_MG_Y,0,Tile.SCALE,Tile.SCALE)
- elseif RondMG == true then
- love.graphics.draw(Tile.Rond,Tile_MG_X,Tile_MG_Y,0,Tile.SCALE,Tile.SCALE)
- end
- if CroixMD == true then
- love.graphics.draw(Tile.Croix,Tile_MD_X,Tile_MD_Y,0,Tile.SCALE,Tile.SCALE)
- elseif RondMD == true then
- love.graphics.draw(Tile.Rond,Tile_MD_X,Tile_MD_Y,0,Tile.SCALE,Tile.SCALE)
- end
- if CroixHG == true then
- love.graphics.draw(Tile.Croix,Tile_HG_X,Tile_HG_Y,0,Tile.SCALE,Tile.SCALE)
- elseif RondHG == true then
- love.graphics.draw(Tile.Rond,Tile_HG_X,Tile_HG_Y,0,Tile.SCALE,Tile.SCALE)
- end
- if CroixHM == true then
- love.graphics.draw(Tile.Croix,Tile_HM_X,Tile_HM_Y,0,Tile.SCALE,Tile.SCALE)
- elseif RondHM == true then
- love.graphics.draw(Tile.Rond,Tile_HM_X,Tile_HM_Y,0,Tile.SCALE,Tile.SCALE)
- end
- if CroixHD == true then
- love.graphics.draw(Tile.Croix,Tile_HD_X,Tile_HG_Y,0,Tile.SCALE,Tile.SCALE)
- elseif RondHD == true then
- love.graphics.draw(Tile.Rond,Tile_HD_X,Tile_HG_Y,0,Tile.SCALE,Tile.SCALE)
- end
- if CroixBG == true then
- love.graphics.draw(Tile.Croix,Tile_BG_X,Tile_BG_Y,0,Tile.SCALE,Tile.SCALE)
- elseif RondBG == true then
- love.graphics.draw(Tile.Rond,Tile_BG_X,Tile_BG_Y,0,Tile.SCALE,Tile.SCALE)
- end
- if CroixBM == true then
- love.graphics.draw(Tile.Croix,Tile_BM_X,Tile_BM_Y,0,Tile.SCALE,Tile.SCALE)
- elseif RondBM == true then
- love.graphics.draw(Tile.Rond,Tile_BM_X,Tile_BM_Y,0,Tile.SCALE,Tile.SCALE)
- end
- if CroixBD == true then
- love.graphics.draw(Tile.Croix,Tile_BD_X,Tile_BD_Y,0,Tile.SCALE,Tile.SCALE)
- elseif RondBD == true then
- love.graphics.draw(Tile.Rond,Tile_BD_X,Tile_BD_Y,0,Tile.SCALE,Tile.SCALE)
- end
- if CroixHD == true and CroixHM == true and CroixHG == true then
- love.graphics.setColor(1,0,0)
- love.graphics.line(Tile_HG_X,Tile_HG_Y + Tile.HAUTEUR/2,Tile_HD_X + Tile.LARGEUR,Tile_HD_Y + Tile.HAUTEUR/2)
- love.graphics.print("CROIX WIN",375,100)
- love.graphics.setColor(1,1,1)
- CroixWin = true
- RonWin = false
- elseif RondHG == true and RondHM == true and RondHD == true then
- love.graphics.setColor(0,0,1)
- love.graphics.line(Tile_HG_X,Tile_HG_Y + Tile.HAUTEUR/2,Tile_HD_X + Tile.LARGEUR,Tile_HD_Y + Tile.HAUTEUR/2)
- love.graphics.print("ROND WIN",375,100)
- love.graphics.setColor(1,1,1)
- RonWin = true
- CroixWin = false
- end
- if CroixMD == true and CroixMM == true and CroixMG == true then
- love.graphics.setColor(1,0,0)
- love.graphics.line(Tile_MG_X,Tile_MG_Y + Tile.HAUTEUR/2,Tile_MD_X + Tile.LARGEUR,Tile_MD_Y + Tile.HAUTEUR/2)
- love.graphics.print("CROIX WIN",375,100)
- love.graphics.setColor(1,1,1)
- CroixWin = true
- RonWin = false
- elseif RondMG == true and RondMM == true and RondMD == true then
- love.graphics.setColor(0,0,1)
- love.graphics.line(Tile_MG_X,Tile_MG_Y + Tile.HAUTEUR/2,Tile_MD_X + Tile.LARGEUR,Tile_MD_Y + Tile.HAUTEUR/2)
- love.graphics.print("ROND WIN",375,100)
- love.graphics.setColor(1,1,1)
- RonWin = true
- CroixWin = false
- end
- if CroixBD == true and CroixBM == true and CroixBG == true then
- love.graphics.setColor(1,0,0)
- love.graphics.line(Tile_BG_X,Tile_BG_Y + Tile.HAUTEUR/2,Tile_BD_X + Tile.LARGEUR,Tile_BD_Y + Tile.HAUTEUR/2)
- love.graphics.print("CROIX WIN",375,100)
- love.graphics.setColor(1,1,1)
- CroixWin = true
- RonWin = false
- elseif RondBG == true and RondBM == true and RondBD == true then
- love.graphics.setColor(0,0,1)
- love.graphics.line(Tile_BG_X,Tile_BG_Y + Tile.HAUTEUR/2,Tile_BD_X + Tile.LARGEUR,Tile_BD_Y + Tile.HAUTEUR/2)
- love.graphics.print("ROND WIN",375,100)
- love.graphics.setColor(1,1,1)
- RonWin = true
- CroixWin = false
- end
- if CroixHD == true and CroixMD == true and CroixBD == true then
- love.graphics.setColor(1,0,0)
- love.graphics.line(Tile_HD_X + Tile.LARGEUR/2,Tile_HD_Y ,Tile_BD_X + Tile.LARGEUR/2,Tile_BD_Y + Tile.LARGEUR)
- love.graphics.print("CROIX WIN",375,100)
- love.graphics.setColor(1,1,1)
- CroixWin = true
- RonWin = false
- elseif RondHD == true and RondMD == true and RondBD == true then
- love.graphics.setColor(0,0,1)
- love.graphics.line(Tile_HD_X + Tile.LARGEUR/2,Tile_HD_Y ,Tile_BD_X + Tile.LARGEUR/2,Tile_BD_Y + Tile.LARGEUR)
- love.graphics.print("ROND WIN",375,100)
- love.graphics.setColor(1,1,1)
- RonWin = true
- CroixWin = false
- end
- if CroixHG == true and CroixMG == true and CroixBG == true then
- love.graphics.setColor(1,0,0)
- love.graphics.line(Tile_HG_X + Tile.LARGEUR/2,Tile_HG_Y ,Tile_BG_X + Tile.LARGEUR/2,Tile_BG_Y + Tile.LARGEUR)
- love.graphics.print("CROIX WIN",375,100)
- love.graphics.setColor(1,1,1)
- CroixWin = true
- RonWin = false
- elseif RondHG == true and RondMG == true and RondBG == true then
- love.graphics.setColor(0,0,1)
- love.graphics.line(Tile_HG_X + Tile.LARGEUR/2,Tile_HG_Y ,Tile_BG_X + Tile.LARGEUR/2,Tile_BG_Y + Tile.LARGEUR)
- love.graphics.print("ROND WIN",375,100)
- love.graphics.setColor(1,1,1)
- RonWin = true
- CroixWin = false
- end
- if CroixHM == true and CroixMM == true and CroixBM == true then
- love.graphics.setColor(1,0,0)
- love.graphics.line(Tile_HM_X + Tile.LARGEUR/2,Tile_HM_Y ,Tile_BM_X + Tile.LARGEUR/2,Tile_BM_Y + Tile.LARGEUR)
- love.graphics.print("CROIX WIN",375,100)
- love.graphics.setColor(1,1,1)
- CroixWin = true
- RonWin = false
- elseif RondHM == true and RondMM == true and RondBM == true then
- love.graphics.setColor(0,0,1)
- love.graphics.line(Tile_HM_X + Tile.LARGEUR/2,Tile_HM_Y ,Tile_BM_X + Tile.LARGEUR/2,Tile_BM_Y + Tile.LARGEUR)
- love.graphics.print("ROND WIN",375,100)
- love.graphics.setColor(1,1,1)
- RonWin = true
- CroixWin = false
- end
- if CroixHG == true and CroixMM == true and CroixBD == true then
- love.graphics.setColor(1,0,0)
- 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)
- love.graphics.print("CROIX WIN",375,100)
- love.graphics.setColor(1,1,1)
- CroixWin = true
- RonWin = false
- elseif RondHG == true and RondMM == true and RondBD == true then
- love.graphics.setColor(0,0,1)
- 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)
- love.graphics.print("ROND WIN",375,100)
- love.graphics.setColor(1,1,1)
- RonWin = true
- CroixWin = false
- end
- if CroixHD == true and CroixMM == true and CroixBG == true then
- love.graphics.setColor(1,0,0)
- 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)
- love.graphics.print("CROIX WIN",375,100)
- love.graphics.setColor(1,1,1)
- CroixWin = true
- RonWin = false
- elseif RondHD == true and RondMM == true and RondBG == true then
- love.graphics.setColor(0,0,1)
- 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)
- love.graphics.print("ROND WIN",375,100)
- love.graphics.setColor(1,1,1)
- RonWin = true
- CroixWin = false
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement