diff --git a/Birdies.py b/Birdies.py index bff41b5..d22016e 100644 --- a/Birdies.py +++ b/Birdies.py @@ -1,24 +1,52 @@ import pgzrun - # Le corps du programme devrait se trouver ici... TITLE = "Paf l'oiseau" WIDTH = 400 HEIGHT = 700 titi = Actor('bird1', (75, 350)) - - +tutu = Actor ('bird2', ( 300, 20)) +top = Actor('top', (300, -150)) +bottom = Actor ('bottom', (300, 800)) +fond = Actor('background', (200,350)) +fond2 = Actor('background', (-200,350)) def draw(): - screen.blit('background', (0, 0)) + fond.draw() + fond2.draw() titi.draw() - -def on_mouse_down(): - titi.x = 0 + tutu.draw() + top.draw() + bottom.draw() + + +def on_mouse_down(pos): + print( pos, 'est la position de titi lors du clic gauche') + titi.backupspeed = titi.speed + tutu.backupspeed = tutu.speed + titi.speed = 0 + tutu.speed = 0 + +def on_mouse_up (): + titi.speed = titi.backupspeed + 2 + tutu.speed = tutu.backupspeed + 2 def update(): - titi.x += titi.speed + fond.x += 2 + fond2.x +=2 + if fond.x > 400 : + fond.x = 200 + if fond2.x > 200 : + fond2.x = 0 + + titi.x += titi.speed + tutu.y += tutu.speed + if titi.x > 400 : + titi.x = 0 + if tutu.y > 700 : + tutu.y = 10 -titi.speed = 2 +titi.speed = 1 +tutu.speed = 1 pgzrun.go() \ No newline at end of file