|
- 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
- saut = -7
- gravite = 0.2
- frotement = 1
- gamemod_speed = -3
- dash = 0
- espassement = 1
-
- def draw():
- screen.blit("back", (0, 0))
- didi.draw()
- th.draw()
- tb.draw()
-
- def update():
- global end, saut, gamemod_speed, dash
-
- 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 += saut
- saut += gravite
- gamemod_speed += dash
-
- if dash < 0 and end == 0:
- dash += frotement
-
- def on_mouse_down(button):
- global saut, dash
- if button == mouse.LEFT:
- saut += -5
- elif button == mouse.RIGHT:
- dash += -1
-
-
- pgzrun.go()
|