Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson2_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
28b1bcab
authored
Nov 20, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
c62ee935
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
21 deletions
qwfw.py
snake.py
勿删谢谢.py
qwfw.py
deleted
100644 → 0
View file @
c62ee935
'''
lis=[2,8,3,6,5,3,8]
a=[]
for i in :
if == :
a.append(i)
print(a)
for j in a:
lis.pop(j)
print(lis)
'''
count
=
0
while
count
<
50
:
count
+=
1
if
count
%
2
==
0
:
continue
print
(
count
,
end
=
''
)
\ No newline at end of file
snake.py
View file @
28b1bcab
...
@@ -13,7 +13,7 @@ background = pygame.image.load('bg.png')
...
@@ -13,7 +13,7 @@ background = pygame.image.load('bg.png')
right
=
pygame
.
image
.
load
(
'right.png'
)
right
=
pygame
.
image
.
load
(
'right.png'
)
food
=
pygame
.
image
.
load
(
'apple.png'
)
food
=
pygame
.
image
.
load
(
'apple.png'
)
body
=
pygame
.
image
.
load
(
'body.png'
)
body
=
pygame
.
image
.
load
(
'body.png'
)
head
=
"right"
x
,
y
=
240
,
120
x
,
y
=
240
,
120
liebiao
=
[(
180
,
90
),(
180
,
120
),(
210
,
120
),(
x
,
y
)]
liebiao
=
[(
180
,
90
),(
180
,
120
),(
210
,
120
),(
x
,
y
)]
while
True
:
while
True
:
...
@@ -22,8 +22,23 @@ while True:
...
@@ -22,8 +22,23 @@ while True:
# 接收到退出事件后退出程序
# 接收到退出事件后退出程序
exit
()
exit
()
if
event
.
type
==
locals
.
KEYDOWN
:
if
event
.
type
==
locals
.
KEYDOWN
:
if
if
event
.
type
==
K_UP
and
head
!=
"down"
:
x
+=
30
head
=
"up"
if
event
.
type
==
K_DOWN
and
head
!=
"up"
:
head
=
"down"
if
event
.
type
==
K_LEFT
and
head
!=
"right"
:
head
=
"left"
if
event
.
type
==
K_RIGHT
and
head
!=
"left"
:
head
=
"right"
if
head
==
"up"
:
y
-=
30
elif
head
==
"down"
:
y
+=
30
elif
head
==
"left"
:
x
-=
30
else
:
x
+=
30
liebiao
.
append
((
x
,
y
))
liebiao
.
append
((
x
,
y
))
liebiao
.
pop
(
0
)
liebiao
.
pop
(
0
)
...
...
勿删谢谢.py
0 → 100644
View file @
28b1bcab
import
turtle
as
t
import
turtle
as
t
for
i
in
range
(
4
):
t
.
seth
((
i
+
1
)
*
90
)
t
.
circle
(
50
,
90
)
t
.
seth
(
-
90
+
90
*
i
)
t
.
circle
(
50
,
90
)
t
.
hideturtle
()
t
.
done
()
\ 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