本文整理匯總了Python中graphics.Graphics.blocktexture方法的典型用法代碼示例。如果您正苦於以下問題:Python Graphics.blocktexture方法的具體用法?Python Graphics.blocktexture怎麽用?Python Graphics.blocktexture使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類graphics.Graphics
的用法示例。
在下文中一共展示了Graphics.blocktexture方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: updateblockgraphix
# 需要導入模塊: from graphics import Graphics [as 別名]
# 或者: from graphics.Graphics import blocktexture [as 別名]
def updateblockgraphix(self, blx, bly): #updates graphics when a block changes
self.newtex = Graphics.blocktexture((self.blocks[blx][bly] & 65280) >>8)[(self.blocks[blx][bly] & 240) >> 4]
# self.surface.blit(self.newtex if not self.blocks[blx][bly] & 0b11110000 == 0b11110000 else pygame.transform.flip(self.newtex, np.random.randint(0, 1), np.random.randint(0, 1)), (blx * 16, bly * 16))
# self.surface.blit(pygame.transform.flip(self.newtex, np.random.randint(0, 2), np.random.randint(0, 2)) if self.blocks[blx][bly] & 0b11110000 == 0b11110000 else self.newtex, (blx * 16, bly * 16)) #flips
self.surface.blit(pygame.transform.flip(pygame.transform.rotate(self.newtex, np.random.randint(0, 4) *90), np.random.randint(0, 2), np.random.randint(0, 2)) if self.blocks[blx][bly] & 0b11110000 == 0b11110000 else self.newtex, (blx * 16, bly * 16)) #flips
if settings.game["debugmode"]:
pygame.draw.line(self.surface, Color.red, (0,0), (0,1024))
pygame.draw.line(self.surface, Color.red, (0,0), (1024,0))