|
- import pgzrun
-
- TITLE = "Paf l'oiseau"
- WIDTH = 918
- HEIGHT = 1024
-
-
- titi = Actor('bird1',(100,200))
- piaf = Actor('bird1',(150,250))
-
- titi.speed = 1
- piaf.speed = 2
-
- def draw():
- screen.blit('rory',(0,0))
- titi.draw()
- piaf.draw()
-
- def update():
- titi.y+=titi.speed
- piaf.x+=piaf.speed
- if titi.top >= HEIGHT:
- titi.bottom = 0
- if piaf.left >= WIDTH:
- piaf.right = 0
-
- def on_mouse_down(button):
- if button == mouse.LEFT:
- print('Accélération!')
- titi.speed+=1
- piaf.speed+=2
- elif button == mouse.RIGHT:
- print('Freinage!')
- titi.speed-=2
- piaf.speed-=4
-
-
- def on_mouse_up():
- print('clicsouris!')
- titi.speed = 1
- piaf.speed = 2
-
- pgzrun.go()
|