python - Pygame, trying to rotate sprite -


i'm trying rotate of sprite game written in pygame

i don't consol error, sprite stay same , doesn't rotate :(

any idea ?

perso.image = pygame.image.load("sprites/[shadow]main_char_sprite.png").convert_alpha() perso.image = pygame.transform.scale(perso.image, (53,60)) perso.rect = perso.image.get_rect() perso.rect.x = 200 perso.rect.y = 200 perso.add(perso_group)  while 1:     screen.fill(white)     pygame.transform.rotate(perso.image,30) ########not working :(          all_group.add(statique_group, zombie_group, perso_group)     all_group.draw(screen)       pygame.display.flip() 

the documentation transform functions says:

all these functions take surface operate on , return new surface results.

so need assign return value of rotate variable:

perso.image = pygame.transform.rotate(perso.image,30) 

however, documentation says:

some of transforms considered destructive. these means every time performed lose pixel data. common examples of resizing , rotating. reason, better retransform original surface keep transforming image multiple times.

so may want keep original, , keep increasing rotation angle instead.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -