Commit b1fcf773 by BellCodeEditor

save project

parent 38d601d3
Showing with 6 additions and 5 deletions
......@@ -17,22 +17,23 @@ x =240
y =120
w=[(180,90),(180,120),(210,120),(x,y)]
setheading='right'
shead=right
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
if event.type==locals.KEYDOWN:
if event.key==k_RIGHT&&setheading!='left':
if event.key==k_RIGHT and setheading!='left':
setheading='right'
shead=right
if event.key==k_LEFT&&setheading!='right':
if event.key==k_LEFT and setheading!='right':
setheading='left'
shead=left
if event.key==k_DOWN&&setheading!='up':
if event.key==k_DOWN and setheading!='up':
setheading='down'
shead=down
if event.key==k_UP&&setheading!='down':
if event.key==k_UP and setheading!='down':
setheading='up'
shead=up
if setheading=="right":
......@@ -41,7 +42,7 @@ while True:
x -=30
if setheading=="down":
y +=30
if setheading=="up"
if setheading=="up":
y -=30
w.append((x,y))
w.pop(0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment