Commit 5acb47b8 by BellCodeEditor

save project

parent f7309ab6
Showing with 11 additions and 4 deletions
...@@ -27,13 +27,12 @@ while True: ...@@ -27,13 +27,12 @@ while True:
if event.type==locals.KEYDOWN: if event.type==locals.KEYDOWN:
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,7 +41,15 @@ while True: ...@@ -42,7 +41,15 @@ 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