Bonjour , j'aimerai que mon personnage saute mais je n'ai aucune idée comment je pourrais faire

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
from tkinter import*
from random import randint
 
 
def defile() :
    global x4 , y4 , x1 , x2 , y2 , x
 
    x1 = x1 +1
    can.move('obstacle', 0,10)
    can.move('mob', -5,0)
    y4 = y4+13
 
 
 
 
    fen.after(50, defile)
    if (x2==50) :
       apparition()
       can.move('mob',0,0)
       x2=0
 
 
 
def droite(event):
    global x1 , x2 , x3 , y2
 
    print(x2)
    if(x2>1160):
        can.move('perso',0,0)
 
    else :
        can.move('perso',10 , 0)
        x2=x2+10
 
def gauche(event):
    global x1 , x2 , x3 , y2
 
    print(x2)
    if(x2<130):
        can.move('perso',0,0)
 
    else :
        can.move('perso',-10 , 0)
        x2=x2-10
 
 
def apparition():
    global x4 , y4
    x4 , y4 = randint(500, 700) , randint(0, 10)
    obs1 = can.create_image(x4,y4, image = obs, anchor='center', tag = ['obstacle'])    #Apparition obstacle au hasard
    obs2 = can.create_image(x4,y4, image = obs, anchor='center', tag = ['obstacle'])
    obs3 = can.create_image(x4,y4, image = obs, anchor='center', tag = ['obstacle'])
 
 
x1 , y1 = 850 , 500
x2 , y2 = 300 , 700
x3 , y3 = 1500 ,700
x4 , y4 = 1500, 1500
 
fen = Tk()
can = Canvas(fen , width = 1700 , height = 1000, bg = 'white')
can.pack()
 
 
 
Fond_jeu = PhotoImage(file = 'fond.png')
Image_Affichee = can.create_image(x1 , y1 , image= Fond_jeu, anchor='center' , tag = ['route'])
 
Perso = PhotoImage(file = 'perso.png')
Image_Affichee = can.create_image(x2 , y2 , image= Perso, anchor='center' , tag = ['perso'])
 
Mob = PhotoImage(file = 'mob.png')
Image_Affichee = can.create_image(x3 , y3 , image= Mob, anchor='center' , tag = ['mob'])
 
obs = PhotoImage(file='obstacle.png')
 
obs1 = can.create_image(x4,y4, image = obs, anchor='center', tag = ['obstacle'])
 
fen.bind("<Right>" , droite)
fen.bind("<Left>" , gauche)
apparition()
defile()
 
fen.mainloop()

Merci d'avance