Commit 95323135 by BellCodeEditor

save project

parent 0af9615f
Showing with 8 additions and 13 deletions
...@@ -19,19 +19,14 @@ body = pygame.image.load('body.png') ...@@ -19,19 +19,14 @@ body = pygame.image.load('body.png')
setheading="right" setheading="right"
a=right a=right
while True: while True:
if setheading=='right': if setheading=="right":
x+=30 x=x+30
a=right
elif setheading=='left': elif setheading=='left':
x-=30 x=x-30
a=right
elif setheading=='up':
y+=30
a=up
elif setheading=='down': elif setheading=='down':
y-=30 y=y+30
a=down else :
y=y-30
sb.append((x,y)) sb.append((x,y))
sb.pop(0) sb.pop(0)
...@@ -39,10 +34,10 @@ while True: ...@@ -39,10 +34,10 @@ while True:
if event.type == locals.QUIT: if event.type == locals.QUIT:
exit() exit()
if event.type==locals.KEYDOWN: 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': if event.key==locals.K_LEFT and setheading !='right':
setheading='left' setheading='left'
if event.key==locals.K_RIGHT and setheading !='left':
setheading='right'
if event.key==locals.K_UP and setheading !='down': if event.key==locals.K_UP and setheading !='down':
setheading='up' setheading='up'
if event.key==locals.K_DOWN and setheading !='up': if event.key==locals.K_DOWN and setheading !='up':
......
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