Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson9_diy4
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
206ac533
authored
Jan 02, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
fee17078
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
my_game.py
record.txt
my_game.py
View file @
206ac533
...
...
@@ -127,8 +127,8 @@ while True:
screen
.
blit
(
gameover
,
(
400
,
200
))
gamestate
=
False
#更新
if
score
>
thr
:
if
score
>
one
:
if
score
>
thr
:
if
score
>
one
:
record
[
"第1名"
]
=
score
record
[
"第2名"
]
=
one
record
[
"第3名"
]
=
two
...
...
@@ -137,7 +137,7 @@ while True:
record
[
"第3名"
]
=
two
else
:
record
[
"第3名"
]
=
score
record
=
json
.
dumps
(
record
,
ensure_asci
l
=
False
)
record
=
json
.
dumps
(
record
,
ensure_asci
i
=
False
)
with
open
(
"record.txt"
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
f
.
write
(
record
)
else
:
...
...
@@ -151,13 +151,13 @@ while True:
#分数
scoreFont
=
baisc_font
.
render
(
"分数"
+
str
(
score
),
True
,(
255
,
255
,
255
))
screen
.
blit
(
scoreFont
,(
880
,
20
))
#_________________________________________________________________
scoreSurf
=
baisc_font
.
render
(
"第1名"
+
str
(
one
),
True
,(
255
,
255
,
255
))
screen
.
blit
(
score
Font
,(
880
,
50
))
screen
.
blit
(
score
Surf
,(
880
,
50
))
scoreSurf
=
baisc_font
.
render
(
"第2名"
+
str
(
two
),
True
,(
255
,
255
,
255
))
screen
.
blit
(
score
Font
,(
880
,
80
))
screen
.
blit
(
score
Surf
,(
880
,
80
))
scoreSurf
=
baisc_font
.
render
(
"第3名"
+
str
(
thr
),
True
,(
255
,
255
,
255
))
screen
.
blit
(
score
Font
,(
880
,
110
))
screen
.
blit
(
score
Surf
,(
880
,
110
))
# 刷新画面
pygame
.
display
.
update
()
FPS
.
tick
(
60
)
\ No newline at end of file
record.txt
View file @
206ac533
{"第1名": 0, "第2名": 0, "第3名": 0}
\ No newline at end of file
{"第1名": 4, "第2名": 3, "第3名": 2}
\ 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