Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson3_diy1
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
e1ffe331
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
139ca2e6
c184359l1354p256a13982/wx655415
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
snake.py
snake.py
View file @
e1ffe331
...
@@ -58,14 +58,15 @@ while True:
...
@@ -58,14 +58,15 @@ while True:
if
(
x
,
y
)
==
(
apple_x
,
apple_y
):
if
(
x
,
y
)
==
(
apple_x
,
apple_y
):
shuax
()
shuax
()
score
+=
1
score
+=
1
#
os.system('cls')
os
.
system
(
'cls'
)
#
print('score:'+str(score))
print
(
'score:'
+
str
(
score
))
if
(
apple_x
,
apple_y
)
in
pos
:
while
(
apple_x
,
apple_y
)
in
pos
:
shuax
()
shuax
()
else
:
else
:
pos
.
pop
(
0
)
pos
.
pop
(
0
)
if
(
x
,
y
)
in
pos
[
0
:
-
2
]:
if
(
x
,
y
)
in
pos
[
0
:
-
2
]:
exit
()
exit
()
...
@@ -80,14 +81,15 @@ while True:
...
@@ -80,14 +81,15 @@ while True:
text
=
my_font
.
render
(
info
,
True
,(
0
,
0
,
0
))
text
=
my_font
.
render
(
info
,
True
,(
0
,
0
,
0
))
screen
.
blit
(
text
,(
540
,
10
))
screen
.
blit
(
text
,(
540
,
10
))
pygame
.
display
.
update
()
pygame
.
display
.
update
()
if
x
>
6
6
0
:
if
x
>
6
3
0
:
(
x
,
y
)
=
(
0
,
y
)
x
=-
30
elif
x
<
0
:
elif
x
<
0
:
(
x
,
y
)
=
(
680
,
y
)
x
=
660
elif
y
>
480
:
elif
y
>
480
:
(
x
,
y
)
=
(
x
,
0
)
y
=-
30
elif
y
<
0
:
elif
y
<
0
:
(
x
,
y
)
=
(
x
,
480
)
y
=
480
FPSCLOCK
.
tick
(
3
)
FPSCLOCK
.
tick
(
3
)
...
...
This diff is collapsed.
Click to expand it.
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