Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import pygame
- from pygame.sprite import Group
- from settings import Settings
- from alien import Alien
- from ship import Ship
- from game_stats import GameStats
- from button import Button
- from scoreboard import Scoreboard
- from game_functions import *
- def run_game():
- # Инициализирует игру и создает объект экрана.
- pygame.init()
- settings = Settings()
- screen = pygame.display.set_mode((settings.screen_width, settings.screen_height))
- pygame.display.set_caption("Alien Invasion")
- stats = GameStats(settings)
- ship = Ship(screen, settings)
- alien = Alien(settings, screen)
- scoreboard = Scoreboard(settings, screen, stats)
- play_button = Button(settings, screen, "Play")
- bullets = Group()
- aliens = Group()
- create_fleet(settings, screen, aliens, ship)
- # bg_color = (230, 230, 230)
- # Запуск основного цикла игры.
- while True:
- update_screen(settings, screen, stats, aliens, ship, bullets, play_button, scoreboard)
- # При каждом проходе цикла перерисовывается экран.
- if stats.game_active:
- ship.update()
- update_bullets(settings, screen, stats, bullets, aliens, ship, scoreboard)
- update_aliens(settings, screen, stats, bullets, ship, aliens)
- check_events(settings, screen, stats, ship, aliens, bullets, play_button, scoreboard)
- run_game()
Advertisement
Add Comment
Please, Sign In to add comment