Commit 15fd01b9 by BellCodeEditor

save project

parent c7bb4deb
Showing with 10 additions and 11 deletions
...@@ -35,14 +35,6 @@ while True: ...@@ -35,14 +35,6 @@ while True:
if event.key==locals.K_LEFT and c!="right": if event.key==locals.K_LEFT and c!="right":
c="left" c="left"
d=le d=le
if c=="left":
x-=30
elif c=="right":
x+=30
elif c=="up":
y-=30
else:
y+=30
# 将背景图画上去\ # 将背景图画上去\
b.append((x,y)) b.append((x,y))
b.pop(0) b.pop(0)
...@@ -52,9 +44,16 @@ while True: ...@@ -52,9 +44,16 @@ while True:
for i in range(len(b)-1): for i in range(len(b)-1):
screen.blit(ri, (b[i])) screen.blit(ri, (b[i]))
# 将贪吃蛇的身体画上去 # 将贪吃蛇的身体画上去
if c=="left":
x-=30
elif c=="right":
x+=30
elif c=="up":
y-=30
else:
y+=30
# 将果实画上去 # 将果实画上去
screen.blit(food, (360, 300)) screen.blit(food, (360, 300))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
a.tick(1) a.tick(2)
\ No newline at end of file \ No newline at end of file
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