mirror of
https://github.com/ada-dmitry/pypet_project.git
synced 2026-09-24 08:10:22 +00:00
start project
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,28 @@
|
|||||||
|
import sys
|
||||||
|
import pygame
|
||||||
|
from settings import Settings
|
||||||
|
|
||||||
|
class AlienInvasion():
|
||||||
|
'''Класс всей игры'''
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
pygame.init()
|
||||||
|
self.settings = Settings()
|
||||||
|
# Поменять разрешение
|
||||||
|
self.screen = pygame.display.set_mode((self.settings.screen_weight, self.settings.screen_height))
|
||||||
|
pygame.display.set_caption("Alien Invasion")
|
||||||
|
|
||||||
|
def run_game(self):
|
||||||
|
'''Запуск игры'''
|
||||||
|
while(1):
|
||||||
|
for event in pygame.event.get():
|
||||||
|
if event.type == pygame.QUIT:
|
||||||
|
sys.exit()
|
||||||
|
pygame.display.flip()
|
||||||
|
# Установить цвет фона из настроек
|
||||||
|
self.screen.fill(self.settings.bg_color)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
AlInv = AlienInvasion()
|
||||||
|
AlInv.run_game()
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
class Settings():
|
||||||
|
'''Класс для хранения настроек Alien Invasion'''
|
||||||
|
def __init__(self):
|
||||||
|
self.screen_weight = 1200
|
||||||
|
self.screen_height = 800
|
||||||
|
self.bg_color = (230, 230, 230)
|
||||||
Reference in New Issue
Block a user