[英]Why does flipping my sprites cause it to move weird
我正在制作一个 pyGame 游戏,我决定水平翻转它,而不是让精灵两侧都可以控制图像中心。
那是我的图纸 function:
def draw(self, screen):
screen.blit(pygame.transform.flip(self.image, self.flip, False), self.rect)
这就是我存储所有imgs的方式:
animation_types = ['stand', 'walk', 'jump', 'attack1', 'attack2', 'attack3']
for animation in animation_types:
#reset temporary list of images
temp_list = []
#count number of files in the folder
num_of_frames = len(os.listdir(f'sprites/{self.char_type}/{animation}'))
for i in range(num_of_frames):
img = pygame.image.load(f'sprites/{self.char_type}/{animation}/{i}.png')
img = pygame.transform.scale(img, (int(img.get_width() * scale), int(img.get_height() * scale)))
temp_list.append(img)
self.animation_list.append(temp_list)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.