import pgzrun import random TITLE = "didi bird" WIDTH = 490 HEIGHT = 490 tb = Actor("bottom", midtop=(490, 350)) th = Actor("top", midbottom=(490, 125)) didi = Actor("bird1", (245, 245)) end = 0 gravitée = 2 saut = -35 gamemod_speed = -3 flash = -30 espassement = 1 def draw(): screen.blit("back", (0, 0)) didi.draw() th.draw() tb.draw() def update(): global end if didi.y == 475 and end == 0: print("--Game over--") end = 1 if didi.y < 475 and end == 0: th.x += gamemod_speed tb.x += gamemod_speed if th.x <= 0: tb.x = 490 tb.y = random.randrange(520,600) th.x = 490 th.y = random.randrange(-160, -40) if didi.y <= 15: didi.y == 15 if end == 0 and (didi.colliderect(tb) or didi.colliderect(th)): print("--Game over--") end = 1 if didi.y < 475 and end == 0 : didi.y += gravitée def on_mouse_down(button): if button == mouse.LEFT: didi.y += saut elif button == mouse.RIGHT: th.x += flash tb.x += flash pgzrun.go()