def texts(score):
font=pygame.font.Font(None,30)
scoretext=font.render("Score:"+str(score), 1,(255,255,255))
screen.blit(scoretext, (500, 457))
font.render
中的第二个参数(1
)是用来做什么的?你知道吗
class safeguardClass(pygame.sprite.Sprite):
def __init__(self,image_file, location = [0,0]):
pygame.sprite.Sprite.__init__(self) #call Sprite initializer
self.image = pygame.image.load(image_file)
self.rect = self.image.get_rect()
self.rect.left, self.rect.top = location
此外,请指导我什么是self
在上述子类?你知道吗
如果您查找
pygame.font.Font.render
的documentation,它会显示:此外,} function 中构造的对象的引用。你知道吗
self
是对在^{第二个参数是抗锯齿,根据PyGame documentation.
相关问题 更多 >
编程相关推荐