Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson3_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
7ab6bbd8
authored
Jul 08, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
bdc3e09e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletions
snake.py
snake.py
View file @
7ab6bbd8
...
...
@@ -25,8 +25,10 @@ apple_y=360
setheading
=
"right"
snake_head
=
right
fenshu
=
0
jieshu
=
0
changdu
=
3
ziti
=
pygame
.
font
.
Font
(
'simsun.ttc'
,
30
)
#载入字体对象
ziti2
=
pygame
.
font
.
Font
(
'simsun.ttc'
,
50
)
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
...
...
@@ -76,6 +78,14 @@ while True:
zifuchang
=
'分数:'
+
str
(
fenshu
)
+
'
\n
长度:'
+
str
(
changdu
)
text
=
ziti
.
render
(
zifuchang
,
True
,(
0
,
0
,
0
))
#创建字体变量
# 刷新画面
screen
.
blit
(
text
,(
400
,
10
))
#显示字
screen
.
blit
(
text
,(
400
,
10
))
if
0
>
x
or
x
>
630
or
0
>
y
or
y
>
450
:
text
=
ziti2
.
render
(
'游戏结束'
,
True
,(
255
,
0
,
0
))
screen
.
blit
(
text
,(
230
,
240
))
jieshu
=
1
pygame
.
display
.
update
()
if
jieshu
==
0
:
#显示字
pygame
.
display
.
update
()
FPSCLOCK
.
tick
(
3
)
\ 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