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
a366b99f
authored
Mar 05, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
d4675754
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
d.py
my_game.py
d.py
0 → 100644
View file @
a366b99f
import
json
jsonData
=
'{"第一名":122,"第二名":109,"第三名":188}'
;
text
=
json
.
loads
(
jsonData
)
print
(
"第一名"
,
text
[
"第一名"
])
print
(
'第二名'
,
text
[
"第二名"
])
print
(
'第三名'
,
text
[
"第三名"
])
my_game.py
View file @
a366b99f
...
...
@@ -54,14 +54,14 @@ gamestate = True
score
=
0
speed
=
0
old_score
=
0
block_list
=
pygame
.
sprite
.
Group
()
# 创建精灵组
with
open
(
'record.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
content
=
f
.
read
()
json
.
loads
(
content
)
record
=
one
(
'第一名'
)
record
=
two
(
'第二名'
)
record
=
three
(
'第三名'
)
dict1
=
json
.
loads
(
content
)
#字典
one
=
([
'第一名'
])
two
=
([
'第二名'
])
three
=
([
'第三名'
])
block_list
=
pygame
.
sprite
.
Group
()
# 创建精灵组
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
...
...
@@ -134,7 +134,7 @@ while True:
old_score
=
score
scoreSurf
=
basic_font
.
render
(
"分数:"
+
str
(
score
),
True
,(
255
,
0
,
0
))
screen
.
blit
(
scoreSurf
,(
850
,
20
))
screen
.
blit
(
record
)
# 刷新画面
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