Un petit jeu réalisé avec pgzero
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

birdie.py 991 B

hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
12345678910111213141516171819202122232425262728293031323334353637383940
  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 += 4
  9. titi.speed = 0
  10. birdi.y +=6
  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 = 5
  16. birdi.y += 10
  17. birdi.speed = 8
  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