# Créé par auxence.fromont, le 08/02/2018 en Python 3.4 # __ _______ _______ _____ ___ __ # /""\ /" \ /" "|(\" \|" \ /""\ # / \ |: |(: ______)|.\\ \ | / \ # /' /\ \ |_____/ ) \/ | |: \. \\ | /' /\ \ # // __' \ // / // ___)_ |. \ \. | // __' \ # / / \\ \ |: __ \ (: "|| \ \ | / / \\ \ # (___/ \___)|__| \___) \_______) \___|\____\)(___/ \___) # ____ __ _ _ ____ ___ ____ ___ __ ____ ____ # / ___) / \ / )( \( _ \ / __)( __) / __)/ \( \( __) # \___ \( O )) \/ ( ) /( (__ ) _) ( (__( O )) D ( ) _) # (____/ \__/ \____/(__\_) \___)(____) \___)\__/(____/(____) from turtle import * # préparation du terrain bgcolor("black") #couleur du fond # tortues "balais" color("white") other = Turtle() other.color("white") left(90) other.right(90) # positionnement des joueurs red = Turtle() red.color("red") blue = Turtle() blue.left(180) blue.color("blue") red.forward(100) blue.forward(100) global red_heading global blue_heading blue_heading = "null" red_heading = "haut" # attributtion des vies blue_live = 1 red_live = 1 # definition des fonctions def haut__bleu() : print("haut bleu") blue_heading = "haut" def bas_bleu() : blue_heading ="bas" def gauche_bleu() : blue_heading ="gauche" def droite_bleu() : blue_heading ="droite" def haut_rouge() : red_heading = "haut" def bas_rouge() : red_heading ="bas" def gauche_rouge() : red_heading ="gauche" def droite_rouge() : red_heading ="droite" def fin(): blue_live = 0 red_live = 0 listen() onkeypress(haut_rouge,"z") onkeypress(bas_rouge,"s") onkeypress(gauche_rouge,"q") onkeypress(droite_rouge,"d") onkeypress(haut_rouge,"Up") onkeypress(bas_rouge,"Down") onkeypress(gauche_rouge,"Left") onkeypress(droite_rouge,"Right") onkeypress(fin,"r") while blue_live + red_live > 1 : # tant que tt le monde vit #déplacements if red_heading == "haut" : red.setheading(90) red.forward(3) if red_heading == "bas" : red.setheading(270) red.forward(3) if red_heading == "gauche" : red.setheading(180) red.forward(3) if red_heading == "droite" : red.setheading(0) red.forward(3) if red_heading == "haut" : blue.setheading(90) blue.forward(3) if red_heading == "bas" : blue.setheading(270) blue.forward(3) if red_heading == "gauche" : blue.setheading(180) blue.forward(3) if red_heading == "droite" : blue.setheading(0) blue.forward(3) blue_live = blue_live - 0.00001 listen() onkeypress(haut_rouge,"z") onkeypress(bas_rouge,"s") onkeypress(gauche_rouge,"q") onkeypress(droite_rouge,"d") onkeypress(haut_rouge,"Up") onkeypress(bas_rouge,"Down") onkeypress(gauche_rouge,"Left") onkeypress(droite_rouge,"Right") onkeypress(fin,"r") mainloop()