Pygame Animation - Pygame RPG Tutorial #6

Опубликовано: 14 Март 2025
на канале: ShawCode
10,379
279

In this Pygame animation tutorial, I show you how to do Pygame animation with sprite sheets, using a pygame animation example.

Python pygame animations can be done with a pygame animation loop. There is a list of images that we loop over, giving us the animation.

ANIMATION CODE:
down_animations = [self.game.character_spritesheet.get_sprite(3, 2, self.width, self.height),
self.game.character_spritesheet.get_sprite(35, 2, self.width, self.height),
self.game.character_spritesheet.get_sprite(68, 2, self.width, self.height)]

up_animations = [self.game.character_spritesheet.get_sprite(3, 34, self.width, self.height),
self.game.character_spritesheet.get_sprite(35, 34, self.width, self.height),
self.game.character_spritesheet.get_sprite(68, 34, self.width, self.height)]

left_animations = [self.game.character_spritesheet.get_sprite(3, 98, self.width, self.height),
self.game.character_spritesheet.get_sprite(35, 98, self.width, self.height),
self.game.character_spritesheet.get_sprite(68, 98, self.width, self.height)]

right_animations = [self.game.character_spritesheet.get_sprite(3, 66, self.width, self.height),
self.game.character_spritesheet.get_sprite(35, 66, self.width, self.height),
self.game.character_spritesheet.get_sprite(68, 66, self.width, self.height)]

This is the 6th tutorial in the pygame RPG tutorial series, where I show you how to make animations in pygame. If you would like to learn how to make an RPG game in python, be sure to subscribe so you don't miss out on future tutorials!

If you found this video useful, be sure to leave a like - it really helps me out!

Thanks for watching!