Un petit jeu réalisé avec pgzero
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
há 3 anos
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import pgzrun
  2. TITLE = "Paf l'oiseau"
  3. WIDTH = 400
  4. HEIGHT = 708
  5. def on_mouse_down():
  6. print('Clic enfoncé souris !')
  7. titi.backupspeed = titi.speed
  8. titi2.backupspeed = titi2.speed
  9. titi.speed = 0
  10. titi2.speed = 0
  11. titi.x -= 50
  12. titi2.y -= 50
  13. def on_mouse_up():
  14. print('Clic souris !')
  15. titi.speed = titi.backupspeed+2
  16. titi2.speed = titi2.backupspeed+2
  17. def draw():
  18. screen.blit('background', (0, 0))
  19. titi.draw()
  20. titi2.draw()
  21. tube_sup.draw()
  22. tube_inf.draw()
  23. titi = Actor('bird1', (75, 350))
  24. titi2 = Actor('bird2', (75, 350))
  25. ecart = 140
  26. tube_sup = Actor('top', (300, 0))
  27. tube_inf = Actor('bottom', (300, tube_sup.height + ecart))
  28. def update():
  29. titi.x += titi.speed
  30. titi2.y += titi2.speed
  31. if titi.x > 400 :
  32. titi.x = 0
  33. if titi2.y > 708 :
  34. titi2.y = 0
  35. vitesse_defilement = 1
  36. tube_sup.x -= vitesse_defilement
  37. tube_inf.x -= vitesse_defilement
  38. if tube_sup.x + tube_sup.width/2< 0 :
  39. tube_sup.x = WIDTH + tube_sup.width/2
  40. tube_inf.x = WIDTH + tube_sup.width/2
  41. if tube_sup.x < 0 :
  42. tube_sup.x = WIDTH
  43. titi.speed = 1
  44. titi2.speed = 1
  45. pgzrun.go()
  46. print(tube_sup.width, tube_sup.height)
  47. vitesse_defilement = 1