Commit afe4f24e by BellCodeEditor

save project

parent 71ca70dd
Showing with 9 additions and 7 deletions
import pygame import pygame
from pygame import locals from pygame import locals
vol=0.2 volume=0.2
click=0 click=0
x,y=(0,0) x,y=(0,0)
pygame.init() # 初始化 pygame.init() # 初始化
...@@ -21,13 +21,15 @@ while True: ...@@ -21,13 +21,15 @@ while True:
exit() exit()
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if event.key == locals.K_UP: if event.key == locals.K_UP:
vol += 0.1 volume += 0.1
if vol>1: if volume>1:
vol=1 volume=1
pygame.mixer.music.set_volume(volume)
if event.key == locals.K_DOWN: if event.key == locals.K_DOWN:
vol -= 0.1 volume -= 0.1
if vol<0: if volume<0:
vol=0 volume=0
pygame.mixer.music.set_volume(volume)
#监听鼠标按下 #监听鼠标按下
if event.type == locals.MOUSEBUTTONDOWN: if event.type == locals.MOUSEBUTTONDOWN:
if event.button==1: if event.button==1:
......
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