dx=100
dw=30
dh=100
gy=80
cw=30
ch=50
g=2
jp=-20
speed=5
cx=1200
rx=1200
dy=500
dy=500
jp=-70
count=0
ry=random(800-gy,800)
dy=700-gy-dh
jp=-20
def setup():
global gameover, jump
gameover=False
jump=False
size(1200,700 )
def drawcactoo():
global cx
fill(0,255,0)
cx=cx-speed
rect(cx,height-gy-ch,cw,ch)
if cx<-40: cx=1240
def rocks():
global rx,ry
rect(rx,ry,20,20)
if rx<0:
rx=rx-speed
def keyPressed():
global jump
if key==' ' and jump==False:
jump=True
if key==UP:
col()
background(250)
line(0,height-gy,width,height-gy)
fill(0)
count+=1
text(count,100,200)
drawcactoo()
rocks()
rect(dx,dy,dw,dh)
def draw():
global dy,jp,count
jump1 ()
if gameover==False:
col()
background(250)
line(0,height-gy,width,height-gy)
fill(0)
count+=1
text(count,100,200)
drawcactoo()
rocks()
rect(dx,dy,dw,dh)
else:
background (0)
count=0
text('GameOver',height/2,width/2)
text (count,100,200)
def col():
global gameover
if cx==dx+dw and (dy-dh)*3>=height-gy-ch:
gameover=True
def jump1():
global jump,dy,jp
if jump==True and dy<=550:
dy+=jp
jp+=3
else:
jump=False
dy=height-gy-dh
jp=-70
Как создать функцию, которая будет перезапускать игру динозаврпри нажатии кнопки