|
- import pgzrun
- # création fenêtre
- TITLE = "Paf l'oiseau" # définition titre
- WIDTH = 400 # largeur
- HEIGHT = 708 #hauteur
-
- def on_mouse_down(): # fonction 'click avec souris'
- print('Clique souris !') # sortie en terminal pour verifier si c'est ok
- if on_mouse_down :
- titi.y =0
- titi.speed = 0
- piou.y =0
- piou.speed = 0
-
- def on_mouse_up(): # fonction 'quand la souris ne click plus'
- print('relache souris')
- if on_mouse_up :
- titi.y += 100
- titi.speed = 5
- piou.speed = 3
-
- def update():
- titi.y += titi.speed # mise a jour (60x/sec) de titi
- piou.y += piou.speed
-
- def draw():
- screen.blit('background', (0, 0)) # import arrière plan
- titi.draw() # 'dessiner' titi
- piou.draw()
-
-
- titi = Actor('bird1', (75, 350)) # définir position de titi
- piou = Actor('bird2', (65,300))
- titi.speed = 5 # définir vitesses de chute de titi
- piou.speed = 3
-
- if titi.x or piou.x > 400 :
- titi.x = 50
- piou.x = 75
-
-
-
-
- pgzrun.go() # syntaxe 'conventionnelle' de pgzero
-
-
|