|
@@ -8,32 +8,32 @@ def on_mouse_down(): # fonction 'click avec souris' |
|
|
print('Clique souris !') # sortie en terminal pour verifier si c'est ok |
|
|
print('Clique souris !') # sortie en terminal pour verifier si c'est ok |
|
|
titi.y -= 50 |
|
|
titi.y -= 50 |
|
|
titi.speed = 0 |
|
|
titi.speed = 0 |
|
|
birdi.y -= 45 |
|
|
|
|
|
birdi.speed = 0 |
|
|
|
|
|
|
|
|
#birdi.y -= 45 |
|
|
|
|
|
# birdi.speed = 0 |
|
|
|
|
|
|
|
|
def on_mouse_up(): # fonction 'quand la souris ne click plus' |
|
|
def on_mouse_up(): # fonction 'quand la souris ne click plus' |
|
|
print('relache souris') |
|
|
print('relache souris') |
|
|
titi.y += 6 |
|
|
titi.y += 6 |
|
|
titi.speed += 3 |
|
|
titi.speed += 3 |
|
|
birdi.y += 10 |
|
|
|
|
|
birdi.speed += 2 |
|
|
|
|
|
|
|
|
# birdi.y += 10 |
|
|
|
|
|
# birdi.speed += 2 |
|
|
|
|
|
|
|
|
def update(): |
|
|
def update(): |
|
|
titi.y += titi.speed # mise a jour (60x/sec) de titi |
|
|
titi.y += titi.speed # mise a jour (60x/sec) de titi |
|
|
birdi.y += birdi.speed |
|
|
|
|
|
|
|
|
# birdi.y += birdi.speed |
|
|
|
|
|
|
|
|
def draw(): |
|
|
def draw(): |
|
|
screen.blit('background', (0, 0)) # import arrière plan |
|
|
screen.blit('background', (0, 0)) # import arrière plan |
|
|
titi.draw() # 'dessiner' titi |
|
|
titi.draw() # 'dessiner' titi |
|
|
birdi.draw() |
|
|
|
|
|
|
|
|
# birdi.draw() |
|
|
|
|
|
|
|
|
birdi = Actor("bird2", (50, 250)) |
|
|
|
|
|
birdi.speed = 2 |
|
|
|
|
|
|
|
|
# birdi = Actor("bird2", (50, 250)) |
|
|
|
|
|
# birdi.speed = 2 |
|
|
titi = Actor('bird1', (75, 350)) # définir position de titi |
|
|
titi = Actor('bird1', (75, 350)) # définir position de titi |
|
|
titi.speed = 3 # définir vitesses de chute de titi |
|
|
titi.speed = 3 # définir vitesses de chute de titi |
|
|
|
|
|
|
|
|
if titi.x > 400 and birdy.x > 400: |
|
|
|
|
|
|
|
|
if titi.x > 400 : #and birdy.x > 400: |
|
|
titi.x = 2 |
|
|
titi.x = 2 |
|
|
birdi.x = 4 |
|
|
|
|
|
|
|
|
#birdi.x = 4 |
|
|
|
|
|
|
|
|
pgzrun.go() # syntaxe 'conventionnelle' de pgzero |
|
|
pgzrun.go() # syntaxe 'conventionnelle' de pgzero |