Commit 95323135 by BellCodeEditor

save project

parent 0af9615f
Showing with 11 additions and 16 deletions
......@@ -19,19 +19,14 @@ body = pygame.image.load('body.png')
setheading="right"
a=right
while True:
if setheading=='right':
x+=30
a=right
elif setheading=='left':
x-=30
a=right
elif setheading=='up':
y+=30
a=up
elif setheading=='down':
y-=30
a=down
if setheading=="right":
x=x+30
elif setheading=='left':
x=x-30
elif setheading=='down':
y=y+30
else :
y=y-30
sb.append((x,y))
sb.pop(0)
......@@ -39,15 +34,15 @@ while True:
if event.type == locals.QUIT:
exit()
if event.type==locals.KEYDOWN:
if event.key==locals.K_RIGHT and setheading !='left':
setheading='right'
if event.key==locals.K_LEFT and setheading !='right':
setheading='left'
if event.key==locals.K_RIGHT and setheading !='left':
setheading='right'
if event.key==locals.K_UP and setheading !='down':
setheading='up'
if event.key==locals.K_DOWN and setheading !='up':
setheading='down'
# 接收到退出事件后退出程序
......
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