本文整理汇总了Python中GameState.get_visible_objects方法的典型用法代码示例。如果您正苦于以下问题:Python GameState.get_visible_objects方法的具体用法?Python GameState.get_visible_objects怎么用?Python GameState.get_visible_objects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameState
的用法示例。
在下文中一共展示了GameState.get_visible_objects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_stat_bars
# 需要导入模块: import GameState [as 别名]
# 或者: from GameState import get_visible_objects [as 别名]
def draw_stat_bars():
pos = Pos(Constants.MAP_CONSOLE_WIDTH + 4, 35)
# SHOW PLAYER STAT BARS
draw_box_bar(pos.x, pos.y, 14, '', GameState.get_player().fighter.hp, GameState.get_player().fighter.base_max_hp,
Color("178, 0, 45"),
Color("64, 0, 16"), layers['side_panel_console'])
draw_box_bar(pos.x, pos.y + 1, 14, '', GameState.get_player().fighter.sp, GameState.get_player().fighter.base_max_sp,
Color("0, 30, 255"),
Color("0, 10, 64"), layers['side_panel_console'])
draw_box_bar(pos.x, pos.y + 2, 14, '', GameState.get_player().fighter.xp, 1000, # TODO: will be NEXT_LVL_XP
Color("255, 255, 0"),
Color("65, 65, 0"), layers['side_panel_console'])
# RENDER MONSTER HEALTH BARS
temp_y = 3
for object in GameState.get_visible_objects():
if object.fighter and (object is not GameState.get_player()): # and Fov.is_visible(obj=object)
if temp_y < 17: # TODO: Make constant to scale UI
draw_box_bar(Constants.MAP_CONSOLE_WIDTH + 1, temp_y, 17, object.name, object.fighter.hp, object.fighter.max_hp,
Color("0, 255, 0"),
Color("0, 64, 0"),
layers['side_panel_console'])
temp_y += 2