Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
Source by www.reddit.com #
 
PREVIOUS NEXT
Tagged: #pygame #positions
ADD COMMENT
Topic
Name
5+5 =