Un petit jeu réalisé avec pgzero
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

52 righe
1.1 KiB

  1. import pgzrun
  2. # Le corps du programme devrait se trouver ici...
  3. TITLE = "Paf l'oiseau"
  4. WIDTH = 400
  5. HEIGHT = 700
  6. titi = Actor('bird1', (75, 350))
  7. tutu = Actor ('bird2', ( 300, 20))
  8. top_tube = Actor('top', (300, 0))
  9. bottom_tube = Actor ('bottom', (300, 800))
  10. fond = Actor('background', (200,350))
  11. fond2 = Actor('background', (-200,350))
  12. def draw():
  13. fond.draw()
  14. fond2.draw()
  15. titi.draw()
  16. tutu.draw()
  17. top_tube.draw()
  18. bottom_tube.draw()
  19. def on_mouse_down(pos):
  20. print( pos, 'est la position de titi lors du clic gauche')
  21. titi.backupspeed = titi.speed
  22. tutu.backupspeed = tutu.speed
  23. titi.speed = 0
  24. tutu.speed = 0
  25. def on_mouse_up ():
  26. titi.speed = titi.backupspeed + 2
  27. tutu.speed = tutu.backupspeed + 2
  28. def update():
  29. fond.x += 2
  30. fond2.x +=2
  31. if fond.x > 400 :
  32. fond.x = 200
  33. if fond2.x > 200 :
  34. fond2.x = 0
  35. titi.x += titi.speed
  36. tutu.y += tutu.speed
  37. if titi.x > 400 :
  38. titi.x = 0
  39. if tutu.y > 700 :
  40. tutu.y = 10
  41. titi.speed = 1
  42. tutu.speed = 1
  43. pgzrun.go()