exo birdie et titi
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

62 satır
1.6 KiB

  1. import pgzrun
  2. TITLE = "Paf l'oiseau"
  3. WIDTH = 400
  4. HEIGHT = 708
  5. # deplacement latéral
  6. def on_mouse_down(button):
  7. print('Clic souris !')
  8. print (button)
  9. if mouse.LEFT is button :
  10. titi.y -= 0 # deplacement horizontal
  11. titi.x += 25 # deplacement latéral
  12. grominet.y -= 0 # deplacement horizontal
  13. grominet.x += 40 # deplacement latéral
  14. if mouse.RIGHT is button :
  15. titi.y += 0 # deplacement horizontal
  16. titi.x -= 25 # deplacement latéral
  17. grominet.y += 0 # deplacement horizontal
  18. grominet.x -= 40 # deplacement latéral
  19. # cela correspond au deplacement de titi du bas vers le haut
  20. def draw():
  21. screen.blit('meme', (0, 0))
  22. titi.draw()
  23. grominet.draw()
  24. #titi = Actor('bird1', (70, 40))
  25. titi = Actor('titi', (200, 60))
  26. grominet = Actor('grominet', (70, 40))
  27. #(70, 350) le premier chiffre position de depart sur axe x
  28. # le deuxieme chiffre position axe y
  29. def update():
  30. titi.y += titi.speed
  31. grominet.y += grominet.speed
  32. #titi.x += tit.speed fera deplacer lateralement
  33. #si on modifie le 1 on augmente la vitesse de la chute
  34. # modif si tombe en bas, doit reapparaitre en haut
  35. if titi.top > HEIGHT :
  36. titi.bottom = 0
  37. if titi.bottom > HEIGHT :
  38. titi.top = 400
  39. if grominet.top > HEIGHT :
  40. grominet.bottom = 0
  41. if grominet.bottom > HEIGHT :
  42. grominet.top = 400
  43. if grominet.left > WIDTH :
  44. grominet.right = 0
  45. if grominet.right > WIDTH :
  46. grominet.left = 700
  47. if titi.left > WIDTH :
  48. titi.right = 0
  49. if titi.right > WIDTH :
  50. titi.left = 0
  51. titi.speed = 1
  52. grominet.speed = 1
  53. pgzrun.go()