Commit 45cb9ecc by BellCodeEditor

save project

parent 1fff2a00
Showing with 10 additions and 10 deletions
...@@ -11,22 +11,22 @@ stop = pygame.image.load('stop.png') ...@@ -11,22 +11,22 @@ stop = pygame.image.load('stop.png')
font = pygame.font.Font('neuropol.ttf',20) font = pygame.font.Font('neuropol.ttf',20)
pygame.mixer.music.load('test.wav') pygame.mixer.music.load('test.wav')
fps = pygame.time.Clock() fps = pygame.time.Clock()
volume = 0.2 volume = 0.5
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
exit() exit()
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if event.key == locals.K_DOWN: if event.key == locals.K_DOWN:
if volume > 0: if volume > 0:
volume -= 0.1 volume -= 0.01
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
if event.key == locals.K_UP: if event.key == locals.K_UP:
if volume < 1: if volume < 1:
volume += 0.1 volume += 0.01
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
pygame.mixer.music.play() pygame.mixer.music.play()
screen.blit(background,(0,0)) screen.blit(background,(0,0))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment