добавил requirements.txt, config.ini, переработал GameMenu.py
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
[Settings]
|
||||
difficult=easy
|
||||
sound=True
|
||||
@@ -1,23 +1,13 @@
|
||||
import pygame
|
||||
from loguru import logger
|
||||
from modules.Game import Game
|
||||
from modules.GameMenu import menu
|
||||
from modules.Mathematics import start_calculating
|
||||
|
||||
|
||||
def main():
|
||||
logger.info("Игра запущена")
|
||||
start_calculating()
|
||||
running = True
|
||||
show_menu = True
|
||||
while running:
|
||||
if show_menu:
|
||||
menu()
|
||||
show_menu = False
|
||||
else:
|
||||
running = False
|
||||
pygame.display.flip()
|
||||
game = Game()
|
||||
from modules.GameMenu import difficulty
|
||||
game = Game(difficulty)
|
||||
game.start()
|
||||
|
||||
|
||||
|
||||
+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)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
dnspython==2.2.1
|
||||
loguru==0.6.0
|
||||
pip==22.3.1
|
||||
pygame==2.1.2
|
||||
pymongo==4.3.3
|
||||
setuptools==65.6.3
|
||||
wheel==0.38.4
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 127 KiB |
@@ -1,4 +1,4 @@
|
||||
from modules.Mathematics import recalculation_events, get_random_event
|
||||
|
||||
event = get_random_event()
|
||||
recalculation_events(event["well"])
|
||||
# from modules.Mathematics import recalculation_events, get_random_event
|
||||
#
|
||||
# event = get_random_event()
|
||||
# recalculation_events(event["well"])
|
||||
|
||||
Reference in New Issue
Block a user