Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson5_diy1
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
4cf7e9c7
authored
a year ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
810064b5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
9 deletions
1.py
my_music.py
五月天.url
1.py
0 → 100644
View file @
4cf7e9c7
class
wgzl
:
def
__init__
(
self
,
name
,
Hp
,
Gj
):
self
.
name
=
name
self
.
Hp
=
Hp
self
.
Gj
=
Gj
def
Sj
(
self
):
self
.
Hp
=
self
.
Hp
+
50
self
.
Gj
=
self
.
Gj
+
10
Lk
=
wgzl
(
"林克"
,
1500
,
180
)
Serd
=
wgzl
(
"塞尔达"
,
1100
,
80
)
Gn
=
wgzl
(
"加侬多夫"
,
8000
,
900
)
bkbl
=
wgzl
(
"波克布林"
,
100
,
50
)
a
=
input
(
"请输入想查询英雄名字"
)
if
a
==
'Lk'
:
print
(
Lk
.
name
,
"血量"
,
Lk
.
Hp
,
"攻击"
,
Lk
.
Gj
)
if
a
==
'Serd'
:
print
(
Serd
.
name
,
"血量"
,
Serd
.
Hp
,
"攻击"
,
Serd
.
Gj
)
if
a
==
'Gn'
:
print
(
Gn
.
name
,
"血量"
,
Gn
.
Hp
,
"攻击"
,
Gn
.
Gj
)
if
a
==
'bkbl'
:
print
(
bkbl
.
name
,
"血量"
,
bkbl
.
Hp
,
"攻击"
,
bkbl
.
Gj
)
Serd
.
Sj
()
print
(
"血月升起,已升级该英雄"
)
print
(
Serd
.
name
,
"血量"
,
Serd
.
Hp
,
"攻击"
,
Serd
.
Gj
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
my_music.py
View file @
4cf7e9c7
import
pygame
from
pygame
import
locals
import
os
pygame
.
init
()
# 初始化
# 创建窗口
...
...
@@ -13,8 +14,16 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img
=
pygame
.
image
.
load
(
'logo.png'
)
# 下一曲按钮
# 载入音乐
pygame
.
mixer
.
music
.
load
(
'歌曲1.wav'
)
# 载入音乐
pygame
.
mixer
.
music
.
load
(
'两只老虎-歌曲.url'
)
#pygame.mixer.music.load('歌曲1.wav') # 载入音乐
music_list
=
[]
path
=
'C:
\\
Users
\\
86132
\\
Desktop
\\
LEGO Software'
wenjian
=
os
.
listdir
(
path
)
for
i
in
wenjian
:
if
i
[
-
4
:]
==
'.wav'
:
music_list
.
append
(
i
)
num
=
-
1
volume
=
0.2
pygame
.
mixer
.
music
.
set_volume
(
volume
)
# 初始播放音量
click
=
0
...
...
@@ -50,15 +59,29 @@ while True:
else
:
play_button
=
play_img
pygame
.
mixer
.
music
.
pause
()
if
x
>
120
and
x
<
220
and
y
>
350
and
y
<
400
:
num
-=
1
if
num
<
0
:
num
=
len
(
music_list
)
-
1
pygame
.
mixer
.
music
.
load
(
path
+
'
\\
'
+
music_list
[
num
])
pygame
.
mixer
.
music
.
play
()
click
=
0
play_button
=
stop_img
if
x
>
420
and
x
<
520
and
y
>
350
and
y
<
400
:
num
+=
1
if
num
>
len
(
music_list
)
-
1
:
num
=
0
pygame
.
mixer
.
music
.
load
(
path
+
'
\\
'
+
music_list
[
num
])
pygame
.
mixer
.
music
.
play
()
click
=
0
play_button
=
stop_img
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
num
+=
1
if
num
>
len
(
music_list
)
-
1
:
num
=
0
pygame
.
mixer
.
music
.
load
(
path
+
'
\\
'
+
music_list
[
num
])
pygame
.
mixer
.
music
.
play
()
# 绘制画面
screen
.
blit
(
bg_img
,
(
0
,
0
))
# 填充背景
screen
.
blit
(
play_button
,
(
270
,
330
))
# 暂停按钮
screen
.
blit
(
logo_img
,
(
170
,
60
))
# 中间logo图
screen
.
blit
(
last_img
,
(
120
,
350
))
# 上一曲
screen
.
blit
(
next_img
,
(
420
,
350
))
# 下一曲
# 刷新画面
pygame
.
display
.
update
()
scree
\ No newline at end of file
This diff is collapsed.
Click to expand it.
五月天.url
0 → 100644
View file @
4cf7e9c7
[InternetShortcut]
[InternetShortcut]
URL=orpheus://orpheus/pub/app.html#/m/artist/?id=13193
This diff is collapsed.
Click to expand it.
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