-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·40 lines (33 loc) · 1.02 KB
/
main.py
File metadata and controls
executable file
·40 lines (33 loc) · 1.02 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
import pygame
import pygame_menu
import gameloop
import quit
import start
import variables
from classes.skilltree import skilltree_menu
name = start.start_game()
screen = pygame.display.set_mode((1000, 800), pygame.RESIZABLE)
pygame.display.set_caption("Python Invaders")
menu = pygame_menu.Menu(
"Python Invaders", 500, 500, theme=pygame_menu.themes.THEME_BLUE
)
menu.add.label(f"High Score: {variables.get_score()}")
menu.add.label(f"Gems (Revives): {variables.get_gem()}")
username = menu.add.text_input("Name :", default=name)
menu.add.button("Play", lambda _=None: gameloop.start_game(screen))
menu.add.range_slider(
"Select Difficulty",
variables.get_difficulty(),
(0.1, 1.0),
1,
rangeslider_id="range_slider",
value_format=lambda x: f"{x:.1f}",
onchange=lambda x: variables.change_difficulty(x),
)
menu.add.button("Skilltree", skilltree_menu(screen))
menu.add.button("Quit", quit.quit_game, username)
running = True
is_paused = False
while running:
menu.mainloop(screen)
pygame.display.flip()