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.0 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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import pgzrun
  2. TITLE = "Paf l'oiseau"
  3. WIDTH = 400
  4. HEIGHT = 708
  5. def on_mouse_down():
  6. print('Clic souris !')
  7. titi.speed = -6.5
  8. def update():
  9. titi.y += titi.speed
  10. tube_superieur.x -= vitesse_defilement
  11. tube_inferieur.x -= vitesse_defilement
  12. if tube_superieur.right < 0 :
  13. tube_superieur.left = WIDTH
  14. tube_inferieur.left = WIDTH
  15. if titi.y > HEIGHT or titi.y < 0 :
  16. reset()
  17. titi.speed += gravite
  18. def draw():
  19. screen.blit('background', (0, 0))
  20. titi.draw()
  21. tube_superieur.draw()
  22. tube_inferieur.draw()
  23. def reset():
  24. print("Retour au départ...")
  25. titi.speed = 1
  26. titi.center = (75, 350)
  27. tube_superieur.center = (300, 0)
  28. tube_inferieur.center = (300, tube_superieur.height + ecart)
  29. titi = Actor('bird1', (75, 350))
  30. titi.speed = 1
  31. ecart = 140
  32. tube_superieur = Actor('top', (300, 0))
  33. tube_inferieur = Actor('bottom', (300, tube_superieur.height + ecart))
  34. vitesse_defilement = 1
  35. gravite = 0.1
  36. # print(tube_superieur.width, tube_superieur.height)
  37. pgzrun.go()