Michael
0
Q:

pygame do you need to use int() for positions

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
0

New to Communities?

Join the community