|
|
@@ -0,0 +1,47 @@ |
|
|
|
import pgzrun |
|
|
|
|
|
|
|
TITLE = "Paf l'oiseau" |
|
|
|
WIDTH = 400 |
|
|
|
HEIGHT = 708 |
|
|
|
|
|
|
|
def on_mouse_down(button): |
|
|
|
if button == mouse.LEFT: |
|
|
|
print("freinage") |
|
|
|
titi.speed -=1 |
|
|
|
elif button == mouse.RIGHT: |
|
|
|
print ("Accélération") |
|
|
|
titi.speed += 1 |
|
|
|
|
|
|
|
def update(): |
|
|
|
if titi.bottom > HEIGHT: |
|
|
|
titi.top = 0 |
|
|
|
if titi.top <0: |
|
|
|
titi.bottom = HEIGHT |
|
|
|
if top.right > WIDTH: |
|
|
|
top.left = 0 |
|
|
|
if top.left <0: |
|
|
|
top.right = WIDTH |
|
|
|
if top1.right > WIDTH: |
|
|
|
top1.left = 0 |
|
|
|
if top1.left <0: |
|
|
|
top1.right = WIDTH |
|
|
|
|
|
|
|
titi.y += titi.speed |
|
|
|
top.x += top.speed |
|
|
|
top1.x += top1.speed |
|
|
|
|
|
|
|
def draw(): |
|
|
|
screen.blit('background', (0, 0)) |
|
|
|
titi.draw() |
|
|
|
top.draw() |
|
|
|
top1.draw() |
|
|
|
titi = Actor ('bird1', (200,50)) |
|
|
|
top = Actor ('top', (0,450) ) |
|
|
|
top1 = Actor ('top', (200,200)) |
|
|
|
titi.speed = 1 |
|
|
|
top.speed = 1 |
|
|
|
top1.speed = 1 |
|
|
|
|
|
|
|
pgzrun.go() |
|
|
|
|
|
|
|
|