Commit cee7b20f by BellCodeEditor

save project

parent ef2ba32d
Showing with 5 additions and 5 deletions
...@@ -24,16 +24,16 @@ while True: ...@@ -24,16 +24,16 @@ while True:
# 接收到退出事件后退出程序 # 接收到退出事件后退出程序
exit() exit()
if event.type==locals.KEYDOWN: if event.type==locals.KEYDOWN:
if event.key==k_RIGHT and setheading!='left': if event.key==locals.K_RIGHT and setheading!='left':
setheading='right' setheading='right'
shead=right shead=right
if event.key==k_LEFT and setheading!='right': if event.key==locals.K_LEFT and setheading!='right':
setheading='left' setheading='left'
shead=left shead=left
if event.key==k_DOWN and setheading!='up': if event.key==locals.K_DOWN and setheading!='up':
setheading='down' setheading='down'
shead=down shead=down
if event.key==k_UP and setheading!='down': if event.key==locals.K_UP and setheading!='down':
setheading='up' setheading='up'
shead=up shead=up
if setheading=="right": if setheading=="right":
...@@ -49,7 +49,7 @@ while True: ...@@ -49,7 +49,7 @@ while True:
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
# 将贪吃蛇画上去 # 将贪吃蛇画上去
screen.blit(right,w[-1]) screen.blit(shead,w[-1])
# 将贪吃蛇的身体画上去 # 将贪吃蛇的身体画上去
for i in range(len(w)-1): for i in range(len(w)-1):
screen.blit(body, w[i]) screen.blit(body, w[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