# How do a make a smooth animation with images of different sizes in pygame?

I have an animation where my player swings his sword, with 5 images in pygame. The normal resting image is 14x22, and the rest are 13x23, 21x23, 18x23, and 18x23. I am having trouble with my character 'Jumping' when he swings his sword, since the size of my image is constantly changing. Could anyone help my with this?

Here's my code for the animation

elif keys[pg.K_SPACE]:
now = pg.time.get_ticks()
try:
if now - self.last_update > self.frame_rate:
if self.direction == 'left':
self.game.player_img = self.game.playerattackleft[self.frame]
self.frame += 1
self.last_update = now
except IndexError:
self.frame = 0


Thanks.

• It sounds like your system is missing the concept of a "hot point" or "registration point" used to align frames of different sizes. Is it safe to assume you've reviewed past Q&A about animating frames of different sizes? – DMGregory Mar 4 at 17:19
• @DMGregory Yes I have read those, but I am unsure on how to implement a hot point into pygame. – Vincent W. Mar 5 at 14:18