добавил requirements.txt, config.ini, переработал GameMenu.py
This commit is contained in:
+2
-2
@@ -3,11 +3,11 @@ from modules.Board import Board
|
||||
|
||||
|
||||
class Game:
|
||||
def __init__(self):
|
||||
def __init__(self, difficulty):
|
||||
pygame.init()
|
||||
size = 500, 500
|
||||
self.screen = pygame.display.set_mode(size)
|
||||
pygame.display.set_caption('Чёрное в белое и наоборот')
|
||||
pygame.display.set_caption(difficulty)
|
||||
self.board = Board(5, 7, self.screen)
|
||||
self.board.set_view(100, 100, 50)
|
||||
self.running = True
|
||||
|
||||
+23
-15
@@ -1,17 +1,25 @@
|
||||
import sys
|
||||
from pygame import *
|
||||
import pygame
|
||||
import pygame_menu
|
||||
|
||||
|
||||
def menu():
|
||||
init()
|
||||
DISPLAYPORT = display.set_mode((480, 600))
|
||||
display.set_caption('The Lonely Shooter')
|
||||
background = image.load('styles/background.jpeg').convert()
|
||||
DISPLAYPORT.blit(background, background.get_rect())
|
||||
display.update()
|
||||
while True:
|
||||
events = event.poll()
|
||||
if events.type == KEYDOWN and events.key == K_RETURN:
|
||||
break
|
||||
elif events.type == QUIT:
|
||||
sys.exit()
|
||||
def set_difficulty(value, _):
|
||||
global difficulty
|
||||
difficulty = value[0][0]
|
||||
|
||||
|
||||
def start_the_game():
|
||||
menu.toggle()
|
||||
|
||||
|
||||
difficulty = ""
|
||||
pygame.init()
|
||||
surface = pygame.display.set_mode((600, 400))
|
||||
mytheme = pygame_menu.themes.THEME_DARK.copy()
|
||||
mytheme.background_color = pygame_menu.baseimage.BaseImage(image_path='styles/background.jpg')
|
||||
menu = pygame_menu.Menu('Welcome', 600, 400, theme=mytheme)
|
||||
menu.add.label("Сложность")
|
||||
menu.add.selector('', [('Простая', 1), ('Средняя', 2), ('Сложная', 3), ('Проигрывать весело', 4)],
|
||||
onchange=set_difficulty)
|
||||
menu.add.button('Play', start_the_game)
|
||||
menu.add.button('Quit', pygame_menu.events.EXIT)
|
||||
menu.mainloop(surface)
|
||||
|
||||
Reference in New Issue
Block a user