Commit 0f031a53 by BellCodeEditor

save project

parent 492da746
Showing with 10 additions and 3 deletions
...@@ -37,15 +37,22 @@ while True: ...@@ -37,15 +37,22 @@ while True:
if event.key==locals.K_LEFT and qqq !="right": if event.key==locals.K_LEFT and qqq !="right":
qqq="left" qqq="left"
snake_head=left snake_head=left
print(event.key)
x+=30 if qqq == "up" :
y -= 30
elif qqq == "left":
x -= 30
elif qqq == "down":
y += 30
else:
x += 30
sss.append((x,y)) sss.append((x,y))
sss.pop(0) sss.pop(0)
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
# 将贪吃蛇画上去 # 将贪吃蛇画上去
screen.blit(right,sss[-1] ) screen.blit(snake_head,sss[-1] )
# 将贪吃蛇的身体画上去 # 将贪吃蛇的身体画上去
for i in range(len(sss)-1): for i in range(len(sss)-1):
screen.blit(body,sss[i]) screen.blit(body,sss[i])
......
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