Un petit jeu réalisé avec pgzero
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

42 行
1.0 KiB

  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 = 3
  16. titi.speed += 1
  17. birdi.y += 10
  18. birdi.speed = 2
  19. birdi.speed += 1
  20. def update():
  21. titi.y += titi.speed # mise a jour (60x/sec) de titi
  22. birdi.y += birdi.speed
  23. def draw():
  24. screen.blit('background', (0, 0)) # import arrière plan
  25. titi.draw() # 'dessiner' titi
  26. birdi.draw()
  27. birdi = Actor("bird2", (50, 250))
  28. birdi.speed = 2
  29. titi = Actor('bird1', (75, 350)) # définir position de titi
  30. titi.speed = 3 # définir vitesses de chute de titi
  31. if titi.x > 400 and birdy.x > 400:
  32. titi.x = 2
  33. birdi.x = 4
  34. pgzrun.go() # syntaxe 'conventionnelle' de pgzero