diff --git a/birdie.py b/birdie.py index f6cb721..6ed9ba2 100644 --- a/birdie.py +++ b/birdie.py @@ -4,23 +4,26 @@ TITLE = "Paf l'oiseau" WIDTH = 400 HEIGHT = 708 -def on_mouse_down(): - print('Clic souris !') - titi.x -= 50 - titi2.x -= 50 - +def on_mouse_down(button): + if button == mouse.LEFT: + print('Freinage') + titi.vitesse -= 1 + elif button == mouse.RIGHT : + print('Accelération') + titi.vitesse += 1 + def update(): + if titi.left > WIDTH: + titi.right = 0 + if titi.right < 0: + titi.left = WIDTH titi.x += titi.vitesse - titi2.x += titi2.vitesse def draw(): screen.blit('background', (0, 0)) titi.draw() - titi2.draw() titi = Actor('bird1', (75, 350)) -titi2 = Actor('bird0', (65,300)) titi.vitesse = 1 -titi2.vitesse = 2 pgzrun.go()