Un petit jeu réalisé avec pgzero
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Birdies.py 1.0 KiB

il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 = Actor('top', (300, -150))
  9. bottom = 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.draw()
  18. bottom.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()