From 9e34dc660c0b41aa84391bf92c0d9b8d2642775e Mon Sep 17 00:00:00 2001 From: Jordan-Pleugers Date: Tue, 8 Dec 2020 14:18:24 +0100 Subject: [PATCH] ajout des tubes --- birdie.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/birdie.py b/birdie.py index 0b8deb1..e14762f 100644 --- a/birdie.py +++ b/birdie.py @@ -21,12 +21,13 @@ def draw(): screen.blit('background', (0, 0)) titi.draw() titi2.draw() - poteau_1.draw() - poteau_2.draw() + tube_sup.draw() + tube_inf.draw() titi = Actor('bird1', (75, 350)) titi2 = Actor('bird2', (75, 350)) -poteau_1 = Actor('bottom',(300,800)) -poteau_2 = Actor('top',(300, -100)) +ecart = 140 +tube_sup = Actor('top', (300, 0)) +tube_inf = Actor('bottom', (300, tube_sup.height + ecart)) def update(): titi.x += titi.speed @@ -35,9 +36,19 @@ def update(): titi.x = 0 if titi2.y > 708 : titi2.y = 0 - + vitesse_defilement = 1 + tube_sup.x += vitesse_defilement + tube_inf.x += vitesse_defilement + if tube_sup.x + tube_sup.width/2< 0 : + tube_sup.x = WIDTH + tube_sup.width/2 + tube_inf.x = WIDTH + tube_sup.width/2 + if tube_sup.x < 0 : + tube_sup.x = WIDTH titi.speed = 1 titi2.speed = 1 pgzrun.go() + +print(tube_sup.width, tube_sup.height) +vitesse_defilement = 1 \ No newline at end of file