|
1234567891011121314151617181920212223242526272829303132 |
- import pgzrun
-
-
- TITLE = "Paf l'oiseau"
- WIDTH = 400
- HEIGHT = 708
- def on_mouse_down():
- print('Clic souris !')
- titi.y -= 50 # deplacement horizontal
- titi.x += 25 # deplacement latéral
- # cela correspond au deplacement de titi du bas vers le haut
- def draw():
- screen.blit('cascade', (0, 0))
- titi.draw()
- #titi = Actor('bird1', (70, 40))
- titi = Actor('bird1', (70, 40))
-
- #(70, 350) le premier chiffre position de depart sur axe x
- # le deuxieme chiffre position axe y
- def update():
- titi.y += titi.speed
- #titi.x += tit.speed fera deplacer lateralement
- #si on modifie le 1 on augmente la vitesse de la chute
- if titi.left > WIDTH :
- titi.right = 0
- # titi left -> pgzrun interprete le calcul par rapport a image background
- # et donc le fond de background est mis a 400 dans la variable width,
- # ce qui donne que si la partie gauche de l'image titi est positionné a
- # un niveau sup a la valeur de width, il se retrouve a un position 0
- titi.speed = 1
-
- pgzrun.go()
|