Ejemplo n.º 1
0
 def _create_unit(self, unit_type, count):
     sapcing = 30
     tmp = 0
     x = 0
     while count > tmp:
         alien = Unit.create_unit(unit_type)
         alien.rect.x += x
         x = alien.rect.x + alien.width + sapcing
         tmp += 1
         self.unit_list.add(alien)
Ejemplo n.º 2
0
def alien_list(setting):
    aliens = Group()
    sapcing = 30
    tmp = 0
    count = 6
    while (count > 0):
        alien = Unit.create_unit('Alien')
        aliens.add(alien)
        alien.rect.x += tmp
        tmp = alien.rect.x + alien.width + sapcing
        count -= 1
    return aliens
Ejemplo n.º 3
0
def run_game():
    pygame.init()
    ai_settings = Setting()
    gf.register_unit()
    screen = pygame.display.set_mode(
        (ai_settings.screen_width, ai_settings.screen_height))
    pygame.display.set_caption("Alien Invasion")
    ship = Unit.create_unit('Ship')
    level_manager = LevelManager(ship, screen)
    config = Config()
    config.load_config('config.json')

    while True:
        level_manager.load(config)
        while level_manager.is_end is False:
            level_manager.run()