📅  最后修改于: 2022-03-11 14:45:41.138000             🧑  作者: Mango
class Hero(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image = load_image('hero.png').convert_alpha()
self.position = [0, 0]
self.rect = self.image.get_rect()
def update(self, dt):
x = round(self.position[0])
y = round(self.position[1])
self.rect.topleft = x, y