Outils pour utilisateurs

Outils du site


isn:pygame03

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
isn:pygame03 [2019/11/14 11:06]
techer.charles_educ-valadon-limoges.fr [La fonction rotate]
isn:pygame03 [2019/11/14 11:17] (Version actuelle)
techer.charles_educ-valadon-limoges.fr [Les activités ...]
Ligne 26: Ligne 26:
 ==== La fonction rotate ==== ==== La fonction rotate ====
 <code python> <code python>
-rotate(Surface, angle)+pygame.transform.rotate(Surface, angle)
 </code> </code>
  
Ligne 53: Ligne 53:
 x_fraise = 50 x_fraise = 50
 y_fraise = 50 y_fraise = 50
-largeur_fraise = 40 
-hauteur_fraise = 40 
-IMG_FRAISE = pygame.image.load("fraise.png") 
  
-# image Ballon +IMG_FRAISE = pygame.image.load("fraise.png").convert_alpha() 
-x_ballon = 10 +#IMG_FRAISE pygame.transform.flip(IMG_FRAISE, True, True) 
-y_ballon = 10 +
-largeur_ballon = 20 +
-hauteur_ballon = 20 +
-IMG_BALLON = pygame.image.load("ballon.png") +
-ballonSpeed = [1,  0] +
-#IMG_BALLON.move(ballonSpeed+
-ballonRect IMG_BALLON.get_rect()+
 while not ARRET: while not ARRET:
   pygame.time.delay(100)   pygame.time.delay(100)
Ligne 73: Ligne 64:
       sys.exit()       sys.exit()
     elif event.type == pygame.KEYDOWN:     elif event.type == pygame.KEYDOWN:
 +      # symétrie axiale 
       if event.key == pygame.K_RIGHT:       if event.key == pygame.K_RIGHT:
-        x_fraise x_fraise + 4+        IMG_FRAISE pygame.transform.flip(IMG_FRAISE, True, False) 
 +      elif event.key == pygame.K_UP: 
 +        IMG_FRAISE = pygame.transform.flip(IMG_FRAISE, False, True) 
 +      # rotation
       elif event.key == pygame.K_LEFT:       elif event.key == pygame.K_LEFT:
-        x_fraise x_fraise - 4   +        IMG_FRAISE pygame.transform.rotate(IMG_FRAISE, 10
- +      # redimensionner 
-  ECRAN.blit(IMG_FRAISE, (x_fraise, y_fraise)+      elif event.key == pygame.K_DOWN
- +        IMG_FRAISE pygame.transform.scale(IMG_FRAISE, (40,40))
-  ECRAN.blit(IMG_BALLON, ballonRect) +
-  ballonRect ballonRect.move(ballonSpeed) +
-  if ballonRect.right > LARGEUR:  +
-    ballonSpeed[0] - ballonSpeed[0]+
  
-  pygame.display.update()+    ECRAN.blit(IMG_FRAISE, (x_fraise, y_fraise)) 
 +    pygame.display.update()
 </code> </code>
 ==== Les activités ... ==== ==== Les activités ... ====
Ligne 93: Ligne 85:
  
  
-https://repl.it/@charlestecher/Gerer-une-image+https://repl.it/@charlestecher/Transformations-geometriques
 <html> <html>
-<iframe height="400px" width="100%" src="https://repl.it/@charlestecher/Gerer-une-image?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>+<iframe height="400px" width="100%" src="https://repl.it/@charlestecher/Transformations-geometriques?lite=true" scrolling="no" frameborder="no" allowtransparency="true" allowfullscreen="true" sandbox="allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-modals"></iframe>
 </html> </html>
  
isn/pygame03.1573725967.txt.gz · Dernière modification: 2019/11/14 11:06 de techer.charles_educ-valadon-limoges.fr