-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmainMenu.py
More file actions
55 lines (44 loc) · 1.56 KB
/
Copy pathmainMenu.py
File metadata and controls
55 lines (44 loc) · 1.56 KB
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
50
51
52
53
54
55
import pygame_menu
import pygame
import main
import rgbColours
import gameoverScreen
''' Create a main menu using pygame menu'''
# pylint: disable=no-member
# Initialization
pygame.init()
pygame.display.set_caption("Escape From Genesis Station!")
icon = pygame.image.load('images/astronaut.png')
pygame.display.set_icon(icon)
surface = pygame.display.set_mode((1280, 720))
pygame.mixer.music.load('sounds/MenuTheme.wav')
pygame.mixer.music.play(-1)
# Start game
def start_the_game():
main.main()
def goToGameover():
gameoverScreen.menu.mainloop(gameoverScreen.surface)
# Title style
mytheme = pygame_menu.themes.THEME_SOLARIZED.copy()
mytheme.title_background_color=(0, 0, 0) # Black, like my soul
mytheme.title_font_size = 25
mytheme.title_font = pygame_menu.font.FONT_8BIT # When 16 bits are too many
# Background image
myimage = pygame_menu.baseimage.BaseImage(
image_path="images/SpaceBackgroundWithGlass.png",
drawing_mode=pygame_menu.baseimage.IMAGE_MODE_REPEAT_XY
)
mytheme.background_color=myimage
# Text font
mytheme.widget_font = pygame_menu.font.FONT_8BIT
mytheme.widget_font_color = rgbColours.CYAN
# Create menu
menu = pygame_menu.Menu(720, 1280, 'Escape From Genesis Station', theme=mytheme)
# Add buttons and images
menu.add_image("images/RobotEnemy1.png", scale=(3, 3))
menu.add_button('Play', start_the_game)
menu.add_button('SuperPlay', start_the_game)
menu.add_button('Please Click Me', start_the_game)
menu.add_button('Free Pizza', goToGameover)
menu.add_button('Quit', pygame_menu.events.EXIT)
menu.add_image("images/astronaut.png", scale=(3, 3))