Un petit jeu réalisé avec pgzero
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

birdie.py 1.1 KiB

il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import pgzrun
  2. TITLE = "Paf l'oiseau"
  3. WIDTH = 400
  4. HEIGHT = 708
  5. def on_mouse_down(button):
  6. if button == mouse.LEFT:
  7. print('freinage')
  8. titi.speed -= 1
  9. elif button == mouse.RIGHT:
  10. print('accélaration')
  11. titi.speed += 1
  12. def on_mouse_up():
  13. titi.speed = 1
  14. blackbird.speed = 1
  15. def update():
  16. if titi.left > WIDTH:
  17. titi.right = 0
  18. if titi.right < 0:
  19. titi.left = WIDTH
  20. titi.x += titi.speed
  21. if tube_superieur.left > WIDTH:
  22. tube_superieur.right = 0
  23. if tube_inferieur.right < 0:
  24. tube_inferieur.left = WIDTH
  25. tube_superieur.x += vitesse_defilement
  26. tube_inferieur.x += vitesse_defilement
  27. def draw():
  28. screen.blit('background', (0, 0))
  29. titi.draw()
  30. blackbird.draw()
  31. tube_superieur.draw()
  32. tube_inferieur.draw()
  33. titi = Actor('bird1', (75, 350))
  34. blackbird = Actor('bird2', (95, 150))
  35. ecart = 140
  36. tube_superieur = Actor('top', (300, 0))
  37. tube_inferieur = Actor('bottom', (300, tube_superieur.height + ecart))
  38. titi.speed = 1
  39. blackbird.speed = 2
  40. vitesse_defilement = 1
  41. print(tube_superieur.width, tube_superieur.height)
  42. pgzrun.go()