Commit 0ccede68 by BellCodeEditor

save project

parent 0bbeb78f
Showing with 10 additions and 8 deletions
......@@ -28,27 +28,29 @@ while True:
if event.key == locals.K_RIGHT and t !="left":
t = "right"
e = right
if event.key == locals.K_RIGHT and t !="down":
if event.key == locals.K_UP and t !="down":
t = "up"
e = up
if event.key == locals.K_RIGHT and t !="right":
if event.key == locals.K_LEFT and t !="right":
t = "left"
e = left
if event.key == locals.K_RIGHT and t !="up":
if event.key == locals.K_DOWN and t !="up":
t = "down"
e = down
if t == "right":
x += 30
X += 30
elif t == "left":
x -= 30
X -= 30
elif t == "up":
x -= 30
Y -= 30
else:
y += 30
Y += 30
# 将背景图画上去
i.append((X,Y))
i.pop(0)
screen.blit(background, (0, 0))
# 将贪吃蛇画上去
screen.blit(right, (X, Y))
screen.blit(e, (X, Y))
# 将贪吃蛇的身体画上去
for r in range(len(i)-1):
screen.blit(body,i[r])
......
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