|
- import pgzrun
-
- TITLE = "Paf l'oiseau"
- WIDTH = 400
- HEIGHT = 708
- direction = 1
-
- def on_mouse_down(button):
- if button == mouse.LEFT:
- print('freinage')
- titi.speed -= 1
- elif button == mouse.RIGHT:
- print('accélaration')
- titi.speed += 1
-
- def on_mouse_up():
- titi.speed = 1
- blackbird.speed = 1
-
- def update():
- if titi.left > WIDTH:
- titi.right = 0
- if titi.right < 0:
- titi.left = WIDTH
- titi.x += titi.speed
-
- def draw():
- screen.blit('background', (0, 0))
- titi.draw()
- blackbird.draw()
-
- titi = Actor('bird1', (75, 350))
- blackbird = Actor('bird2', (95, 150))
- titi.speed = 1
- blackbird.speed = 2
-
- pgzrun.go()
|