I've a little problem. I'm writting a program in Python with Pygame, and I have a player moving with key of the keyboard (Right, left, jump ...). But, I would like to create an animation when my player "walks", because I have 6 image (PNG) to do this, but I can't do it. This is my program :
self.image = pygame.image.load(image_perso_droite).convert_alpha()
frame_1 = pygame.image.load("images/GIF/course_6.png").convert_alpha()
frame_2 = pygame.image.load("images/GIF/course_5.png").convert_alpha()
frame_3 = pygame.image.load("images/GIF/course_4.png").convert_alpha()
frame_4 = pygame.image.load("images/GIF/course_3.png").convert_alpha()
frame_5 = pygame.image.load("images/GIF/course_2.png").convert_alpha()
frame_6 = pygame.image.load("images/GIF/course_1.png").convert_alpha()
self.frame_set = [frame_1, frame_2, frame_3, frame_4, frame_5, frame_6]
self.current_frame = 0
self.timer = time.clock()
self.image = self.frame_set[self.current_frame]
if droite:
self.xvel = 8
if time.clock() >= self.timer + .05 and self.onGround:
self.current_frame = 1
self.image = self.frame_set[self.current_frame]
I try also with pyganim, without success. Thank you.