You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The SecondMenu class consists of a String color, which represents the color of the board chosen by the user.
38
41
The class also has three functions, start_game_menu, start_game_vs_player, and start_game_vs_computer.
39
42
"""
43
+
44
+
def__init__(self, track):
45
+
self.selected_music_track=track
46
+
self.background_music=BackgroundMusic([track])
47
+
40
48
color=RED
41
49
defstart_game_menu(self):
42
50
"""
43
51
The start game menu function displays the second menu of the game, which allows the user to choose between playing against another player or against the computer.
Copy file name to clipboardExpand all lines: main.py
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,8 @@
7
7
fromSecondMenuimportSecondMenu
8
8
fromconstantsimportBLUE, YELLOW, RED, GREEN
9
9
fromScoreManagerimportScoreManager
10
+
fromSecondMenuimportSecondMenu
11
+
10
12
11
13
pygame.init()
12
14
pygame.mixer.init() # initialize pygame mixer for music
@@ -21,6 +23,9 @@
21
23
tracks= ["music/Track1.mp3", "music/Track2.mp3", "music/Track3.mp3", "music/Track4.mp3", "music/Track5.mp3", "music/Track6.mp3", "music/Track7.mp3", "music/Track8.mp3"] # can add more or delete tracks if we do not like them
22
24
current_track=0
23
25
SONG_END=pygame.USEREVENT+1
26
+
second_menu=SecondMenu(tracks)
27
+
28
+
24
29
defmusic_loop():
25
30
"""
26
31
The music loop function loops through the music tracks in the tracks list.
0 commit comments