Un petit jeu réalisé avec pgzero
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 line
1.0 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 = 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()