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.

45 lignes
786 B

  1. import pgzrun
  2. TITLE = "Paf l'oiseau"
  3. WIDTH = 400
  4. HEIGHT = 700
  5. titi = Actor('bird1', (300,10))
  6. titi2 = Actor('bird2', (125,75))
  7. pot1 = Actor('top',(300,-100))
  8. pot2 = Actor('bottom',(300,800))
  9. def draw():
  10. screen.blit('background',(0,0))
  11. titi.draw()
  12. titi2.draw()
  13. pot1.draw()
  14. pot2.draw()
  15. def on_mouse_down():
  16. print('Clic souris !')
  17. titi.backupspeed= titi.speed
  18. titi2.backupspeed= titi2.speed
  19. titi.speed = 0
  20. titi2.speed = 0
  21. def on_mouse_up():
  22. print('clic souris !')
  23. titi.speed = titi.backupspeed + 1
  24. titi2.speed = titi2.backupspeed + 1
  25. def update():
  26. titi.y += titi.speed
  27. titi2.x += titi2.speed
  28. if titi.y > 700 :
  29. titi.y = 0
  30. if titi2.x > 400 :
  31. titi2.x = 0
  32. titi.speed = 1
  33. titi2.speed = 1
  34. pgzrun.go()