import sys
import pygame
from settings import Settings
from ship import Ship
from ship_state import ShipState
from bullet_state import BulletState
import game_funcations as gf
from pygame.sprite import Group
from alien import Alien
from alien_state import AlienState
from game_stats import GameStats


def run_game():
    ''' 初始化游戏并创建一个屏幕'''
    pygame.init()
    ai_settings = Settings()
    ship_state = ShipState()
    bullet_state = BulletState()
    alien_state = AlienState()
    screen = pygame.display.set_mode((ai_settings.screen_width, ai_settings.screen_height))
    pygame.display.set_caption("外星人入侵")

    game_stats = GameStats(ai_settings, ship_state, bullet_state, alien_state)

    # 创建一艘飞船
    ship = Ship(screen, ship_state)
    # 创建一个存储子弹的编组
    bullets = Group()
    # 外星人编组
    aliens = Group()

    gf.create_fleet(ai_settings, screen, alien_state, aliens, ship.rect.height)

    # 开始游戏主循环
    while True:
        # 监视加键盘鼠标
        gf.check_events(ship, screen, bullets, bullet_state)

        if game_stats.alive:

            # 实时绘制飞船
            ship.upLocationData()

            # 更新子弹状态
            gf.update_bullets(bullets, aliens, ai_settings, screen, alien_state, ship)

            # 更新外星人状态
            gf.update_aliens(aliens, bullets, game_stats, screen, ship)

        # 更新屏幕显示
        gf.updata_screen(ai_settings, screen, ship, bullets, aliens)


run_game()

361ff8ef1729c4ecf7640052b168041f0d4c0b79
<mask token>

<mask token>


def run_game():
    """ 初始化游戏并创建一个屏幕"""
    pygame.init()
    ai_settings = Settings()
    ship_state = ShipState()
    bullet_state = BulletState()
    alien_state = AlienState()
    screen = pygame.display.set_mode((ai_settings.screen_width, ai_settings
        .screen_height))
    pygame.display.set_caption('外星人入侵')
    game_stats = GameStats(ai_settings, ship_state, bullet_state, alien_state)
    ship = Ship(screen, ship_state)
    bullets = Group()
    aliens = Group()
    gf.create_fleet(ai_settings, screen, alien_state, aliens, ship.rect.height)
    while True:
        gf.check_events(ship, screen, bullets, bullet_state)
        if game_stats.alive:
            ship.upLocationData()
            gf.update_bullets(bullets, aliens, ai_settings, screen,
                alien_state, ship)
            gf.update_aliens(aliens, bullets, game_stats, screen, ship)
        gf.updata_screen(ai_settings, screen, ship, bullets, aliens)


<mask token>

<mask token>


def run_game():
    """ 初始化游戏并创建一个屏幕"""
    pygame.init()
    ai_settings = Settings()
    ship_state = ShipState()
    bullet_state = BulletState()
    alien_state = AlienState()
    screen = pygame.display.set_mode((ai_settings.screen_width, ai_settings
        .screen_height))
    pygame.display.set_caption('外星人入侵')
    game_stats = GameStats(ai_settings, ship_state, bullet_state, alien_state)
    ship = Ship(screen, ship_state)
    bullets = Group()
    aliens = Group()
    gf.create_fleet(ai_settings, screen, alien_state, aliens, ship.rect.height)
    while True:
        gf.check_events(ship, screen, bullets, bullet_state)
        if game_stats.alive:
            ship.upLocationData()
            gf.update_bullets(bullets, aliens, ai_settings, screen,
                alien_state, ship)
            gf.update_aliens(aliens, bullets, game_stats, screen, ship)
        gf.updata_screen(ai_settings, screen, ship, bullets, aliens)


run_game()

import sys
import pygame
from settings import Settings
from ship import Ship
from ship_state import ShipState
from bullet_state import BulletState
import game_funcations as gf
from pygame.sprite import Group
from alien import Alien
from alien_state import AlienState
from game_stats import GameStats


def run_game():
    """ 初始化游戏并创建一个屏幕"""
    pygame.init()
    ai_settings = Settings()
    ship_state = ShipState()
    bullet_state = BulletState()
    alien_state = AlienState()
    screen = pygame.display.set_mode((ai_settings.screen_width, ai_settings
        .screen_height))
    pygame.display.set_caption('外星人入侵')
    game_stats = GameStats(ai_settings, ship_state, bullet_state, alien_state)
    ship = Ship(screen, ship_state)
    bullets = Group()
    aliens = Group()
    gf.create_fleet(ai_settings, screen, alien_state, aliens, ship.rect.height)
    while True:
        gf.check_events(ship, screen, bullets, bullet_state)
        if game_stats.alive:
            ship.upLocationData()
            gf.update_bullets(bullets, aliens, ai_settings, screen,
                alien_state, ship)
            gf.update_aliens(aliens, bullets, game_stats, screen, ship)
        gf.updata_screen(ai_settings, screen, ship, bullets, aliens)


run_game()

import sys
import pygame
from settings import Settings
from ship import Ship
from ship_state import ShipState
from bullet_state import BulletState
import game_funcations as gf
from pygame.sprite import Group
from alien import Alien
from alien_state import AlienState
from game_stats import GameStats


def run_game():
    ''' 初始化游戏并创建一个屏幕'''
    pygame.init()
    ai_settings = Settings()
    ship_state = ShipState()
    bullet_state = BulletState()
    alien_state = AlienState()
    screen = pygame.display.set_mode((ai_settings.screen_width, ai_settings.screen_height))
    pygame.display.set_caption("外星人入侵")

    game_stats = GameStats(ai_settings, ship_state, bullet_state, alien_state)

    # 创建一艘飞船
    ship = Ship(screen, ship_state)
    # 创建一个存储子弹的编组
    bullets = Group()
    # 外星人编组
    aliens = Group()

    gf.create_fleet(ai_settings, screen, alien_state, aliens, ship.rect.height)

    # 开始游戏主循环
    while True:
        # 监视加键盘鼠标
        gf.check_events(ship, screen, bullets, bullet_state)

        if game_stats.alive:

            # 实时绘制飞船
            ship.upLocationData()

            # 更新子弹状态
            gf.update_bullets(bullets, aliens, ai_settings, screen, alien_state, ship)

            # 更新外星人状态
            gf.update_aliens(aliens, bullets, game_stats, screen, ship)

        # 更新屏幕显示
        gf.updata_screen(ai_settings, screen, ship, bullets, aliens)


run_game()
