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
0d187b5e
authored
Oct 16, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
064bbb4e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
6 deletions
my_game.py
record.txt → score.txt
my_game.py
View file @
0d187b5e
...
@@ -58,7 +58,7 @@ old_score = score
...
@@ -58,7 +58,7 @@ old_score = score
block_list
=
pygame
.
sprite
.
Group
()
# 创建精灵组
block_list
=
pygame
.
sprite
.
Group
()
# 创建精灵组
w
h
ith
open
(
'score.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
with
open
(
'score.txt'
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
content
=
f
.
read
()
content
=
f
.
read
()
record
=
json
.
loads
(
content
)
record
=
json
.
loads
(
content
)
a
=
record
[
"第1名"
]
a
=
record
[
"第1名"
]
...
@@ -140,14 +140,13 @@ while True:
...
@@ -140,14 +140,13 @@ while True:
scoreSurF
=
basic_font
.
render
(
'分数:'
+
str
(
score
),
True
,(
255
,
255
,
255
))
scoreSurF
=
basic_font
.
render
(
'分数:'
+
str
(
score
),
True
,(
255
,
255
,
255
))
screen
.
blit
(
scoreSurF
,(
880
,
20
))
screen
.
blit
(
scoreSurF
,(
880
,
20
))
scoreSurF
=
basic_font
.
render
(
'
分数
:'
+
str
(
a
),
True
,(
255
,
255
,
255
))
scoreSurF
=
basic_font
.
render
(
'
第一名
:'
+
str
(
a
),
True
,(
255
,
255
,
255
))
screen
.
blit
(
scoreSurF
,(
880
,
50
))
screen
.
blit
(
scoreSurF
,(
880
,
50
))
scoreSurF
=
basic_font
.
render
(
'
分数
:'
+
str
(
b
),
True
,(
255
,
255
,
255
))
scoreSurF
=
basic_font
.
render
(
'
第二名
:'
+
str
(
b
),
True
,(
255
,
255
,
255
))
screen
.
blit
(
scoreSurF
,(
880
,
80
))
screen
.
blit
(
scoreSurF
,(
880
,
80
))
scoreSurF
=
basic_font
.
render
(
'
分数
:'
+
str
(
c
),
True
,(
255
,
255
,
255
))
scoreSurF
=
basic_font
.
render
(
'
第三名
:'
+
str
(
c
),
True
,(
255
,
255
,
255
))
screen
.
blit
(
scoreSurF
,(
880
,
110
))
screen
.
blit
(
scoreSurF
,(
880
,
110
))
# 刷新画面
# 刷新画面
pygame
.
display
.
update
()
pygame
.
display
.
update
()
FPS
.
tick
(
60
)
FPS
.
tick
(
60
)
\ No newline at end of file
record
.txt
→
score
.txt
View file @
0d187b5e
File moved
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