Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson9_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
e3be566b
authored
Mar 05, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
a366b99f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
my_game.py
my_game.py
View file @
e3be566b
...
...
@@ -54,14 +54,15 @@ gamestate = True
score
=
0
speed
=
0
old_score
=
0
with
open
(
'record.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
content
=
f
.
read
()
dict1
=
json
.
loads
(
content
)
#字典
one
=
([
'第一名'
])
two
=
([
'第二名'
])
three
=
([
'第三名'
])
block_list
=
pygame
.
sprite
.
Group
()
# 创建精灵组
block_list
=
pygame
.
sprite
.
Group
()
# 创建精灵组
with
open
(
r'c:\Users\玛酷001\Documents\pygame_lesson9_diy3\record.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
conten
=
f
.
read
()
print
(
conten
)
t
=
json
.
loads
(
conten
)
one
=
t
[
"第1名"
]
two
=
t
[
"第2名"
]
three
=
t
[
"第3名"
]
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
...
...
@@ -134,7 +135,12 @@ while True:
old_score
=
score
scoreSurf
=
basic_font
.
render
(
"分数:"
+
str
(
score
),
True
,(
255
,
0
,
0
))
screen
.
blit
(
scoreSurf
,(
850
,
20
))
scoreSurf
=
basic_font
.
render
(
"第1名:"
+
str
(
one
),
True
,(
255
,
0
,
0
)
screen
.
blit
(
scoreSurf
,(
850
,
50
)
scoreSurf
=
basic_font
.
render
(
"第2名:"
+
str
(
two
),
True
,(
255
,
0
,
0
)
screen
.
blit
(
scoreSurf
,(
850
,
80
)
scoreSurf
=
basic_font
.
render
(
"第3名:"
+
str
(
three
),
True
,(
255
,
0
,
0
)
screen
.
blit
(
scoreSurf
,(
850
,
110
)
# 刷新画面
pygame
.
display
.
update
()
FPS
.
tick
(
60
)
\ No newline at end of file
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