It should be easy.
If you write the frame number in a variable, you can modulo this with the number of frames that you must get in order to display the frame number of the animation.
frame_count = 0
animation_frames = 4
while quit == False:
area = pygame.Rect(
image_number * 100,
(frame_count % animation_frames) * 150,
100,
150
)
display.blit(sprite, sprite_pos, area)
pygame.display.flip()
frame_count += 1
If different actions have different frames, you will have to update the animation frames when updating image_number.
, , , . , , , , :
area = pygame.Rect(
image_number * 100,
((frame_count - action_start_frame) % animation_frames) * 150,
100,
150
)
. , , , , , , , keyup, , .
, , , / , pygame.key.get_pressed.
, , , , . , , , .
2D . - 60 , , , , . , 2D-, Metal Slug, , ?
. , .