Commit 5acb47b8 by BellCodeEditor

save project

parent f7309ab6
Showing with 9 additions and 2 deletions
...@@ -28,12 +28,11 @@ while True: ...@@ -28,12 +28,11 @@ while True:
if event.key==locals.K_RIGHT and setheading!=right: if event.key==locals.K_RIGHT and setheading!=right:
setheading='right' setheading='right'
snakehead=right snakehead=right
x=x+30
if event.key==locals.K_LEFT and setheading!=left: if event.key==locals.K_LEFT and setheading!=left:
setheding='left' setheding='left'
snakehead=left snakehead=left
x=x-30
if event.key==locals.K_DOWN and setheading!=down: if event.key==locals.K_DOWN and setheading!=down:
setheading='down' setheading='down'
snakehead=down snakehead=down
...@@ -42,6 +41,14 @@ while True: ...@@ -42,6 +41,14 @@ while True:
setheading='up' setheading='up'
snakehead=up snakehead=up
if setheading=='right':
x=x+30
elif setheading=='left':
x=x-30
elif setheading=='down':
y=y+30
else:
y=y-30
position.append((x,y)) position.append((x,y))
position.pop(0) position.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