本文整理汇总了Python中World.get_block_id方法的典型用法代码示例。如果您正苦于以下问题:Python World.get_block_id方法的具体用法?Python World.get_block_id怎么用?Python World.get_block_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.get_block_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: render
# 需要导入模块: import World [as 别名]
# 或者: from World import get_block_id [as 别名]
def render(self, pos, screen):
if self.can_place:
img = World.block_images[False][World.get_block_id(self.name)]
else:
img = self.imgs[0]
screen.blit(img, (pos[0] + GUI.SCALING / 6, pos[1] + GUI.SCALING / 6))
if self.stackable:
countimg = Game.get_font().render(str(self.count), 0, Game.WHITE)
screen.blit(countimg, (pos[0] + 3 * Game.SCALE, pos[1] + 3 * Game.SCALE))
示例2: render
# 需要导入模块: import World [as 别名]
# 或者: from World import get_block_id [as 别名]
def render(self, screen):
left = (Game.SCREEN_WIDTH - 192) / 2
top = (Game.SCREEN_HEIGHT - 192) / 2
pygame.draw.rect(screen, Game.BLACK, pygame.Rect(left, top, 192, 192), 0)
inventory = self.player.inventory
for r in range(len(inventory)):
for c in range(len(inventory[r])):
inv_item = inventory[r][c]
if inv_item is not None:
# c and r are flipped here so it renders across then down
screen.blit(
World.block_images[World.get_block_id(inv_item.itemtype)], (left + c * 32, top + r * 32)
)
countimg = Game.get_font().render(str(inv_item.count), 0, Game.WHITE)
screen.blit(countimg, (left + c * 32, top + r * 32))