-
Notifications
You must be signed in to change notification settings - Fork 0
/
menu.py
57 lines (53 loc) · 2.21 KB
/
menu.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
50
51
52
53
54
55
56
57
import pygame
import window
import images
import superficie
import music
import game
imagens = images.images()
sup = superficie.superficie()
musica = music.music()
class menu():
def __init__(self):
self.window = window.window(800,600,"jogo",imagens.menu,0,0)
self.window.setBack(imagens.menu,(0,0))
self.window.setBackSup(sup.sound,imagens.soundOn,(0,0)) #posição da imagem dentro da superficie
self.window.superficie(sup.sound,(750,0))
self.menu()
def redraw(self,img,imgSound):
self.window.setBack(img,(0,0))
self.window.setBackSup(sup.sound,imgSound,(0,0)) #posição da imagem dentro da superficie
self.window.superficie(sup.sound,(750,0))
def menu(self):
RunOn = True
frames = pygame.time.Clock()
esta_tocando = True
sound = imagens.soundOn
self.window.music_on(esta_tocando,musica.menu)
while RunOn:
frames.tick(30)
for event in pygame.event.get():
if (event.type == pygame.QUIT):
RunOn = False
elif (event.type == pygame.MOUSEBUTTONDOWN):
(mouseX,mouseY) = event.pos
if (mouseX >= 251) and (mouseX <= 548):
if (mouseY >= 179) and (mouseY <= 244):
RunOn = False
game.game()
elif (mouseY >= 299 ) and (mouseY <= 369):
print("sobre")
elif (mouseY >= 421) and (mouseY <= 489):
RunOn = False
elif ((mouseX >= 750) and (mouseX <= 800)) and ((mouseY>= 0) and (mouseY <= 50)):
if esta_tocando:
esta_tocando = False
sound = imagens.soundOff
else:
esta_tocando = True
sound = imagens.soundOn
self.window.music_on(esta_tocando,musica.menu)
if RunOn:
self.window.redraw(imagens.menu,sound,self.window)
pygame.display.update()
menu()