本文整理汇总了Python中hud.Hud.registerListeners方法的典型用法代码示例。如果您正苦于以下问题:Python Hud.registerListeners方法的具体用法?Python Hud.registerListeners怎么用?Python Hud.registerListeners使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hud.Hud
的用法示例。
在下文中一共展示了Hud.registerListeners方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: WallTorch
# 需要导入模块: from hud import Hud [as 别名]
# 或者: from hud.Hud import registerListeners [as 别名]
walltorch_lefttop = WallTorch(Character.Direction.LEFT)
walltorch_lefttop.rect.x = 0
walltorch_lefttop.rect.y = 64 * 2
walltorch_leftbottom = WallTorch(Character.Direction.LEFT)
walltorch_leftbottom.rect.x = 0
walltorch_leftbottom.rect.y = 64 * 5
cricket = Cricket()
cricket.loadSprites()
crabzone = Rect(left_wall.rect.right + 64, top_wall.rect.bottom + 64, right_wall.rect.left - left_wall.rect.width - 128, bottom_wall.rect.top - top_wall.rect.height - 128)
crabspawner = CrabSpawner(crabzone)
hud_space = Rect(0, bottom_wall.rect.bottom, width, height - left_wall.rect.height)
hud = Hud(hud_space)
hud.registerListeners(cricket, crabspawner)
clock = pygame.time.Clock()
#display.fill(blue)
pygame.display.flip()
while 1:
clock.tick(60)
for event in pygame.event.get():
if event.type == pygame.QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE):
sys.exit()
if((event.type == KEYDOWN) or (event.type == KEYUP)):
keyhandler.handle(event)