当前位置: 首页>>代码示例>>Python>>正文


Python Hud.display_player_stats方法代码示例

本文整理汇总了Python中hud.Hud.display_player_stats方法的典型用法代码示例。如果您正苦于以下问题:Python Hud.display_player_stats方法的具体用法?Python Hud.display_player_stats怎么用?Python Hud.display_player_stats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hud.Hud的用法示例。


在下文中一共展示了Hud.display_player_stats方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from hud import Hud [as 别名]
# 或者: from hud.Hud import display_player_stats [as 别名]
def main():
    """ Main Program """
    pygame.init()
 
    # Set the height and width of the screen
    size = [SCREEN_WIDTH, SCREEN_HEIGHT]
    screen = pygame.display.set_mode(size)
 
    pygame.display.set_caption("Dungeon Dreams Demo")
 
    # Create the player
    map_pix_size = 30

 
    # Create all the levels
    level_list = []
#    level_list.append( Level_01(player) )
 
    # Set the current level
    current_level_no = 0
    current_level = 0
#    current_level = level_list[current_level_no]

    active_sprite_list = pygame.sprite.Group()

 
    # Loop until the user clicks the close button.
    done = False
 
    # Used to manage how fast the screen updates
    clock = pygame.time.Clock()
    all_sprites_list = pygame.sprite.LayeredDirty()
    collid_list = pygame.sprite.LayeredDirty()
    mobiles_list = pygame.sprite.Group()
    m_attacks = pygame.sprite.Group()
    area = None
    image_files = glob.glob('HumanMage.PNG')
    hud = Hud(screen)
    player = Player(100,100,image_files,hud)
    hud.display_player_stats(player.stats)
    player.set_all_sprites(all_sprites_list)
    screen_size = (screen.get_width(),screen.get_height())
    m_fact = Monster_Factory(area,collid_list,50,screen_size,all_sprites_list,player)
    map_tool = Map_Handler(screen,all_sprites_list,collid_list,player,mobiles_list,
                           m_fact,hud)
    map_tool.build_area()
    item_fact = map_tool.get_item_fact()

    shift_x = 0
    shift_y = 0
    
    all_mobiles = m_fact.get_mobiles_group()
    dam_mod = 1
    #init path finding...
    path_finder = a_star(collid_list,50)
    player.group_add(all_mobiles)

    image_files = glob.glob('*.PNG')
    
    #init events for following and monsters, start at 3 seconds because
    #player needs a second or two catch bearings
    FOLLOW_EVENT = USEREVENT + 1
    M_ATTACK_EVENT = USEREVENT + 2
    pygame.time.set_timer(FOLLOW_EVENT, 3000)
    pygame.time.set_timer(M_ATTACK_EVENT,3000)
    game_start = False
    #-------- Main Program Loop -----------
    while not done:

        #Probably would make a class just to handle
        #client events.
        #These handle the movements
        keys = pygame.key.get_pressed()
        if keys[pygame.K_h]:
            player.changespeed(-1, 0)
        if keys[pygame.K_l]:
            player.changespeed(1, 0)
        if keys[pygame.K_k]:
            player.changespeed(0, -1)
        if keys[pygame.K_j]:
            player.changespeed(0, 1)
        if keys[pygame.K_n]: 
            player.changespeed(1,1)
        if keys[pygame.K_b]: 
            player.changespeed(-1,1)
        if keys[pygame.K_y]:
            player.changespeed(-1,-1)
        if keys[pygame.K_u]:
            player.changespeed(1,-1)

        #More events, quit and attacks and stopping the player
        #when the button goes up.
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                done = True

            player.check_events(event)

            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_SPACE:
#.........这里部分代码省略.........
开发者ID:gjmiles,项目名称:adventure_pygame,代码行数:103,代码来源:client.py


注:本文中的hud.Hud.display_player_stats方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。