Commit fea11fba by BellCodeEditor

auto save

parent 9775f282
Showing with 8 additions and 7 deletions
......@@ -28,6 +28,7 @@ snake_head=right
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -42,13 +43,13 @@ while True:
setheading = "left"
snake_head=left
if event.type == locals.KEYDOWN:
if event.key == locals.K_UP and setheading != "up":
setheading = "down"
snake_head=down
if event.type == locals.KEYDOWN:
if event.key == locals.K_DOWN and setheading != "down":
if event.key == locals.K_UP and setheading != "down":
setheading = "up"
snake_head=up
if event.type == locals.KEYDOWN:
if event.key == locals.K_DOWN and setheading != "up":
setheading = "down"
snake_head=down
if setheading == "right":
......@@ -57,14 +58,14 @@ while True:
x -= 30
elif setheading == "up":
y -= 30
elif:
else:
y += 30
shenti.append((x,y))
shenti.pop(0)
# 将背景图画上去
screen.blit(background, (0, 0))
# 将贪吃蛇画上去
screen.blit(right,shenti[-1])
screen.blit(snake_head,shenti[-1])
# 将贪吃蛇的身体画上去
for i in range(len(shenti)-1):
screen.blit(body,shenti[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