-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.py
37 lines (30 loc) · 1.07 KB
/
config.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
import pygame
class Screen:
def __init__(self):
print('carregando tela...')
self.screen = pygame.display.set_mode((640, 480), 0, 32)
pygame.display.set_caption("ITApyghters")
def display_update(self, newScreen):
adjNewScreen = pygame.transform.scale2x(newScreen)
self.screen.blit(adjNewScreen, (0, 0))
pygame.display.update()
class SoundPlayer:
def __init__(self):
print('carregando SoundPlayer')
self.music_vol = 0.1
self.sound_vol = 0.2
def play_music(self, file):
if file.find('sound/music/') < 0:
file = 'sound/music/' + file
pygame.mixer.music.stop()
while pygame.mixer.music.get_busy():
print('wait...', end='')
pygame.mixer.music.load(file)
pygame.mixer.music.set_volume(self.music_vol)
pygame.mixer.music.play(-1)
def play_sound(self, file):
if file.find('sound/') < 0:
file = 'sound/'+file
sound = pygame.mixer.Sound(file)
sound.set_volume(self.sound_vol)
sound.play()