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.

59 lignes
1.3 KiB

  1. import pgzrun
  2. TITLE = "Paf l'oiseau"
  3. WIDTH = 400
  4. HEIGHT = 708
  5. def on_mouse_down(): # Quand on clic avec la souris
  6. print('Clic souris !')
  7. titi.y -= 1
  8. titi.x += 0
  9. titi.speed = 0
  10. tutu.y -= 0
  11. tutu.x += 1
  12. tutu.speed = 0
  13. def on_mouse_up(): # Quand on relache le bouton de la souris
  14. print("Souris Don't clic !")
  15. titi.x += 20
  16. titi.y -= 10
  17. titi.speed = 1
  18. tutu.x += 30
  19. tutu.y -= 5
  20. titi.speed = 1
  21. def update():
  22. titi.y += titi.speed
  23. if titi.left > WIDTH: # Si Titi gauche arrive à plus que la valeur WIDTH
  24. titi.right = 0 # il retourne à la position 0 de droite
  25. if tutu.left > WIDTH: # Si Tutu gauche arrive à plus que la valeur WIDTH
  26. tutu.right = 0 # il retourne à la position 0 de droite
  27. #if titi.bottom > HEIGHT: # Si Titi dépasse la profondeur de l'ecran
  28. #dead.go
  29. #dead.x += 1
  30. #dead.y -= 1
  31. #dead.speed += 1
  32. def draw():
  33. screen.blit('background', (0, 0)) # Défini le fond d'écran
  34. titi.draw()
  35. tutu.draw()
  36. #dead.draw()
  37. titi = Actor('bird1', (60, 0)) # Défini l'objet acteur Titi
  38. tutu = Actor('bird2', (70, 10)) #Défini l'objet acteur Tutu
  39. #dead = Actor('birddead', (200, 708)) # Défini l'objet acteur Dead
  40. titi.speed = 1
  41. tutu.speed = 1
  42. #dead.speed = 1
  43. pgzrun.go()