|
|
@@ -3,27 +3,47 @@ import pgzrun |
|
|
|
TITLE = "vava bird" |
|
|
|
WIDTH = 490 |
|
|
|
HEIGHT = 490 |
|
|
|
|
|
|
|
tb = Actor("bottom", (500, 600)) |
|
|
|
th = Actor("top", (500, -100)) |
|
|
|
oiseau = Actor("bird1", (245, 15)) |
|
|
|
end = 0 |
|
|
|
d = 2 |
|
|
|
g = 1 |
|
|
|
g = 2 |
|
|
|
c = -35 |
|
|
|
gm = -2 |
|
|
|
def draw(): |
|
|
|
screen.blit("back", (0, 0)) |
|
|
|
oiseau.draw() |
|
|
|
th.draw() |
|
|
|
tb.draw() |
|
|
|
|
|
|
|
def update(): |
|
|
|
global d |
|
|
|
if oiseau.y < 470: |
|
|
|
oiseau.x += d |
|
|
|
if oiseau.y < 470: |
|
|
|
oiseau.y += d |
|
|
|
if oiseau.y >= 470: |
|
|
|
print("Game Over") |
|
|
|
global end |
|
|
|
|
|
|
|
if oiseau.y == 475 and end == 0: |
|
|
|
print("--Game over--") |
|
|
|
end = 1 |
|
|
|
|
|
|
|
if oiseau.y < 475 and end == 0: |
|
|
|
th.x += gm |
|
|
|
tb.x += gm |
|
|
|
|
|
|
|
if oiseau.y <= 15: |
|
|
|
oiseau.y == 15 |
|
|
|
|
|
|
|
if end == 0 and (oiseau.colliderect(tb) or oiseau.colliderect(th)): |
|
|
|
print("--Game over--") |
|
|
|
end = 1 |
|
|
|
|
|
|
|
if oiseau.y < 475 and end == 0 : |
|
|
|
oiseau.y += g |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def on_mouse_down(): |
|
|
|
print ('') |
|
|
|
if oiseau.y > 15: |
|
|
|
oiseau.y += c |
|
|
|
|
|
|
|
def draw(): |
|
|
|
screen.blit("back", (0, 0)) |
|
|
|
oiseau.draw() |
|
|
|
|
|
|
|
oiseau = Actor("bird1", (20, 15)) |
|
|
|
|
|
|
|
pgzrun.go() |