diff --git a/birdie.py b/birdie.py index dc3c5b2..7ee1918 100644 --- a/birdie.py +++ b/birdie.py @@ -27,8 +27,6 @@ def draw(): titi = Actor ('bird1', (100,10)) titi.speed = 1 - - pgzrun.go() diff --git a/birdie000.py b/birdie000.py new file mode 100644 index 0000000..dce0627 --- /dev/null +++ b/birdie000.py @@ -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() + +