-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
38 lines (29 loc) · 939 Bytes
/
main.py
File metadata and controls
38 lines (29 loc) · 939 Bytes
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
import tkinter as tk
import pygame
from game_screen import show_game_screen
from intro_screen import show_intro_screen
from splash_screen import show_splash_screen
from graph_controller import grid_generator
from constants import VOLUME
root = tk.Tk()
root.withdraw()
pygame.mixer.init()
pygame.mixer.music.load("assets/bgm2.mp3")
pygame.mixer.music.set_volume(VOLUME / 100)
pygame.mixer.music.play(-1)
win_sound = pygame.mixer.Sound("assets/hooray.mp3")
win_sound.set_volume(1.0)
lose_sound = pygame.mixer.Sound("assets/aww.mp3")
lose_sound.set_volume(1.0)
show_splash_screen(root)
while True:
result = show_intro_screen(root)
if result["action"] == 0:
root.destroy()
break
SIZE = result["size"]
MOVES = result["moves"]
MODE = result["mode"]
graph, color = grid_generator(SIZE)
show_game_screen(root, graph, color, MOVES, MODE, SIZE, win_sound, lose_sound)
root.mainloop()