Un petit jeu réalisé avec pgzero
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
921 B

  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 = 8
  27. titi = Actor('bird1', (75, 350)) # définir position de titi
  28. titi.speed = 5 # définir vitesses de chute de titi
  29. pgzrun.go() # syntaxe 'conventionnelle' de pgzero