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.

48 lignes
888 B

  1. import pgzrun
  2. TITLE = "Paf l'oiseau"
  3. WIDTH = 400
  4. HEIGHT = 708
  5. def on_mouse_down(button):
  6. if button == mouse.LEFT:
  7. print("freinage")
  8. titi.speed -=1
  9. elif button == mouse.RIGHT:
  10. print ("Accélération")
  11. titi.speed += 1
  12. def update():
  13. if titi.bottom > HEIGHT:
  14. titi.top = 0
  15. if titi.top <0:
  16. titi.bottom = HEIGHT
  17. if top.right > WIDTH:
  18. top.left = 0
  19. if top.left <0:
  20. top.right = WIDTH
  21. if top1.right > WIDTH:
  22. top1.left = 0
  23. if top1.left <0:
  24. top1.right = WIDTH
  25. titi.y += titi.speed
  26. top.x += top.speed
  27. top1.x += top1.speed
  28. def draw():
  29. screen.blit('background', (0, 0))
  30. titi.draw()
  31. top.draw()
  32. top1.draw()
  33. titi = Actor ('bird1', (200,50))
  34. top = Actor ('top', (0,450) )
  35. top1 = Actor ('top', (200,200))
  36. titi.speed = 1
  37. top.speed = 1
  38. top1.speed = 1
  39. pgzrun.go()