Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson4_diy3
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
12d099ac
authored
Sep 04, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
ab33b4c3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
my music.py
my music.py
View file @
12d099ac
...
@@ -23,18 +23,18 @@ while True:
...
@@ -23,18 +23,18 @@ 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_UP
:
if
event
.
key
==
locals
.
K_UP
:
#当按下上键
volume
+=
0.1
volume
+=
0.1
#音量+0.1
if
volume
>
1
:
if
volume
>
1
:
#如果音量大于1
volume
=
1
volume
=
1
#设音量为1
if
event
.
key
==
locals
.
K_DOWN
:
if
event
.
key
==
locals
.
K_DOWN
:
#当按下下键
volume
-=
0.1
volume
-=
0.1
#音量-0.1
if
volume
<
0
:
if
volume
<
0
:
#如果音量小于0
volume
=
0
volume
=
0
#设音量为1
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
#检测音乐是否正在播放-如果不在播放
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
#检测音乐是否正在播放-如果不在播放
pygame
.
mixer
.
music
.
play
()
#播放音乐
pygame
.
mixer
.
music
.
play
()
#播放音乐
# 绘制画面
# 绘制画面
screen
.
blit
(
bg_img
,
(
0
,
0
))
# 填充背景
screen
.
blit
(
bg_img
,
(
0
,
0
))
# 填充背景
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment