當前位置: 首頁>>代碼示例>>Python>>正文


Python GameState.get_visible_objects方法代碼示例

本文整理匯總了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
開發者ID:joekane,項目名稱:DeepFriedSuperNova,代碼行數:27,代碼來源:Render.py


注:本文中的GameState.get_visible_objects方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。