Un petit jeu réalisé avec pgzero
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

birdie.py 996 B

3 år sedan
3 år sedan
3 år sedan
3 år sedan
3 år sedan
123456789101112131415161718192021222324252627282930313233343536373839
  1. import pgzrun
  2. # création fenêtre
  3. TITLE = "Paf l'oiseau" # définition titre
  4. WIDTH = 400 # largeur
  5. HEIGHT = 708 #hauteur
  6. def on_mouse_down(): # fonction 'click avec souris'
  7. print('Clique souris !') # sortie en terminal pour verifier si c'est ok
  8. titi.y -= 50
  9. titi.speed = 0
  10. birdi.y -= 45
  11. birdi.speed = 0
  12. def on_mouse_up(): # fonction 'quand la souris ne click plus'
  13. print('relache souris')
  14. titi.y += 6
  15. titi.speed += 3
  16. birdi.y += 10
  17. birdi.speed += 2
  18. def update():
  19. titi.y += titi.speed # mise a jour (60x/sec) de titi
  20. birdi.y += birdi.speed
  21. def draw():
  22. screen.blit('background', (0, 0)) # import arrière plan
  23. titi.draw() # 'dessiner' titi
  24. birdi.draw()
  25. birdi = Actor("bird2", (50, 250))
  26. birdi.speed = 2
  27. titi = Actor('bird1', (75, 350)) # définir position de titi
  28. titi.speed = 3 # définir vitesses de chute de titi
  29. if titi.x > 400 and birdy.x > 400:
  30. titi.x = 2
  31. birdi.x = 4
  32. pgzrun.go() # syntaxe 'conventionnelle' de pgzero