1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
   |  
obstacle= [0, 0, 0, 0]
pos_x_o2 = 0
def app_obst(x):
    global obstacle, del_obst, dpcmt, pos_x_b
    while x >= 0:
            for i in range (len(obstacle)):
                if i == len(obstacle):
                    i=0
                can.move(obstacle[i], -dpcmt, 0)
                x = x - dpcmt
                print(x, ", ", pos_y_o)
                if x <= -30:
                    del_obst= True
                    can.delete(obstacle[i])
                elif (pos_x_b-20 < x < pos_x_b+50) & (pos_y_b+320 < pos_y_o <= pos_y_b+360):
                    game_over()
 
def deplacement():                                             
        global obstacle, pos_x_o, pos_x_o2, del_obst
        pos_x_o2 = pos_x_o
        while arret == False:
            fen.after(100, app_obst(pos_x_o2))
 
def obst(): #dessin de l'obstacle
    for i in range (len (obstacle)):
        obstacle[i] = can.create_rectangle(pos_x_o,pos_y_o,pos_x_o+30,pos_y_o+30, fill='red') | 
Partager