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


Python Ship.blitme方法代码示例

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


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

示例1: run_game

# 需要导入模块: from ship import Ship [as 别名]
# 或者: from ship.Ship import blitme [as 别名]
def run_game():
    # initialize game and create a screen object.
    # initialize pygame, settings, and screen object>
    pygame.init()
    ai_settings = Settings()
    screen = pygame.display.set_mode((ai_settings.screen_width, ai_settings.screen_height))
    pygame.display.set_caption("alien ivasion")

    # make a ship.
    ship = Ship(ai_settings, screen)

    # start the main loop for the game.
    while True:


        gf.check_events(ship)
        ship.update()
        gf.update_screen(ai_settings, screen, ship)


        # redraw the screen during each pass through  the loop.
        screen.fill(ai_settings.bg_color)
        ship.blitme()

        # make the most recently drawn screen visible.
        pygame.display.flip()
开发者ID:AlanArvizu739,项目名称:alienivasion,代码行数:28,代码来源:alien_invasion.py

示例2: run_game

# 需要导入模块: from ship import Ship [as 别名]
# 或者: from ship.Ship import blitme [as 别名]
def run_game():
    pygame.init() #make game
    ai_settings = Settings() #make settings object which has settings
    screen = pygame.display.set_mode((ai_settings.screen_width,ai_settings.screen_height)) #make window
    pygame.display.set_caption("Alien Invasion") #title for window
    ship = Ship(screen)
    
    while True: #forever loop for the window
        for event in pygame.event.get(): #wait for user to exit
            if event.type == pygame.QUIT:
                sys.exit()
                
        screen.fill(ai_settings.bg_color)
        ship.blitme()
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        pygame.display.flip() #redraw
开发者ID:markolo25,项目名称:Python-Crash-Course,代码行数:34,代码来源:alien_invasion.py

示例3: run_game

# 需要导入模块: from ship import Ship [as 别名]
# 或者: from ship.Ship import blitme [as 别名]
def run_game():
    # Initialize pygame, settings, and screen object.
    pygame.init()
    ai_settings = Settings()
    screen = pygame.display.set_mode(
        (ai_settings.screen_width, ai_settings.screen_height))
    pygame.display.set_caption("Alien Invasion")

    # Make a ship, a group of bullets, and a group of aliens.
    ship = Ship(ai_settings, screen)
    bullets = Group()
    aliens = Group()

    # Create the fleet of aliens.
    gf.create_fleet(ai_settings, screen, aliens)


    # Start the main loop for the game.
    while True:
        gf.check_events(ai_settings, screen, ship, bullets)
        ship.update()
        gf.update_bullets(bullets)
        gf.update_screen(ai_settings, screen, ship, aliens, bullets)

        # Redraw the screen during each pass through the loop.
        screen.fill(ai_settings.bg_color)
        ship.blitme()

        # Make the most recently drawn screen visible.
        pygame.display.flip()
开发者ID:jonnybarca,项目名称:Alien_Invasion,代码行数:32,代码来源:Alien_Invasions+project.py

示例4: run_game

# 需要导入模块: from ship import Ship [as 别名]
# 或者: from ship.Ship import blitme [as 别名]
def run_game():
    """运行游戏"""

    # 初始化游戏并创建一个屏幕对象
    pygame.init()
    ai_settings = Settings()
    screen = pygame.display.set_mode(
        (ai_settings.screen_width, ai_settings.screen_height))
    pygame.display.set_caption(ai_settings.title)

    ship = Ship(screen)

    # 开始游戏的主循环
    while True:

        # 监视键盘和鼠标事件
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit(0)

        screen.fill(ai_settings.bg_color)
        ship.blitme()

        # 让最近回执的屏幕可见
        pygame.display.flip()
开发者ID:gitxw,项目名称:PythonStudy,代码行数:27,代码来源:alien_invasion.py

示例5: run_game

# 需要导入模块: from ship import Ship [as 别名]
# 或者: from ship.Ship import blitme [as 别名]
def run_game():
    pygame.init()  # 初始化背景,让游戏运行
    sets = Setting()  # 实例化Setting类
    screen = pygame.display.set_mode((sets.screen_width, sets.screen_height))  # 创建一个显示窗口
    pygame.display.set_caption('打飞机')
    screen.fill(sets.bg_color)
    ship = Ship(screen)
    while True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()
        screen.fill(sets.bg_color)
        ship.blitme()
        pygame.display.flip()
开发者ID:VincentJcui,项目名称:Myporjects,代码行数:17,代码来源:game.py

示例6: run_game

# 需要导入模块: from ship import Ship [as 别名]
# 或者: from ship.Ship import blitme [as 别名]
def run_game():
    pygame.init()
    ai_settings = Settings()
    screen = pygame.display.set_mode((ai_settings.screen_width, ai_settings.screen_height))
    pygame.display.set_caption('Alien Invasion')

    ship = Ship(screen)

    while True:
        gf.check_events()

        screen.fill(ai_settings.bg_color)
        ship.blitme()

        pygame.display.flip()
开发者ID:ohitsmekatie,项目名称:alien-invaders,代码行数:17,代码来源:alien_invaders.py

示例7: run_game

# 需要导入模块: from ship import Ship [as 别名]
# 或者: from ship.Ship import blitme [as 别名]
def run_game():
    pygame.init()

    ai_settings = Settings()

    screen = pygame.display.set_mode((ai_settings.screen_width, ai_settings.screen_height))

    pygame.display.set_caption("Alien Invasion")
    # make a ship
    ship = Ship(screen)
    bg_color = (ai_settings.bg_color)

    while True:
        gf.check_events(ship)
        ship.update()
        gf.update_screen(ai_settings, screen, ship)
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()

        screen.fill(bg_color)
        ship.blitme()
        pygame.display.flip()
开发者ID:lildizzle,项目名称:Alien_Invasion,代码行数:25,代码来源:Alien_invasion.py

示例8: run_game

# 需要导入模块: from ship import Ship [as 别名]
# 或者: from ship.Ship import blitme [as 别名]
def run_game():
    pygame.init()
    ai_settings = Settings()
    screen = pygame.display.set_mode((ai_settings.screen_width, ai_settings.screen_height))
    pygame.display.set_caption("Alien Invasion")
    ship = Ship(ai_settings, screen)
    bullets = Group()
    while True:
        gf.check_events(ai_settings, screen, ship, bullets)
        ship.update()
        bullets.update()
        gf.update_screen(ai_settings, screen, ship, bullets)
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
        screen.fill(ai_settings.bg_color)
        ship.blitme()
        pygame.display.flip()
        bullets.update()
        for bullet in bullets.copy():
            if bullet.rect.bottom <= 0:
                bullets.remove(bullet)
        print(len(bullets))
开发者ID:MarvelousJudson12,项目名称:alienInvasion,代码行数:25,代码来源:alien_invasion.py

示例9: run_game

# 需要导入模块: from ship import Ship [as 别名]
# 或者: from ship.Ship import blitme [as 别名]
def run_game():

  pygame.init()

  screen = pygame.display.set_mode((600, 600))
  pygame.display.set_caption('Learn PyGame!')

  #This is what will make a ship object:
  ship = Ship(screen)


  bg_color = (255,255,255)

  while True: 
    for event in pygame.event.get():
      if event.type == QUIT:
        pygame.quit()
        sys.exit()

    screen.fill(bg_color)
    #Calling the ship object to appear on the screen. This line MUST come after the screen.fill line.
    #If it does not come after then the background will cover up the image. 
    ship.blitme() 
    pygame.display.flip()
开发者ID:ravenusmc,项目名称:pygame,代码行数:26,代码来源:image.py


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