-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
49 lines (37 loc) · 1.28 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import pygame
import pygame_menu
from asteroid_deflector import start_asteroid_deflector
from game_2048 import start_2048
from dx_ball_lite import start_dx_ball_lite
from air_hockey import start_air_hockey
pygame.init()
surface = pygame.display.set_mode((600, 400))
pygame.display.set_caption('Game World')
game_selected_to_play = 0
font = pygame_menu.font.FONT_MUNRO
mytheme = pygame_menu.themes.Theme(background_color=(
0, 0, 0, 0), title_shadow=True, title_background_color=(187, 0, 0), widget_font=font, title_font=font)
def set_game(_, value):
global game_selected_to_play
game_selected_to_play = value
def start_the_game():
if game_selected_to_play == 0:
start_asteroid_deflector()
elif game_selected_to_play == 1:
start_2048()
elif game_selected_to_play == 2:
start_dx_ball_lite()
elif game_selected_to_play == 3:
start_air_hockey()
menu = pygame_menu.Menu(
width=600,
height=400,
title='Game World',
theme=mytheme
)
menu.add_selector('', [('Asteroid Deflector', 0), ('2048', 1),
('DX Ball Lite', 2), ('Air Hockey', 3)], onchange=set_game)
menu.add_button('LET\'S PLAY!', start_the_game)
menu.add_button('Quit', pygame_menu.events.EXIT)
if __name__ == '__main__':
menu.mainloop(surface)