Commit c2060837 by BellCodeEditor

save project

parent 484cc320
Showing with 3 additions and 1 deletions
...@@ -18,6 +18,8 @@ down = pygame.image.load('down.png') ...@@ -18,6 +18,8 @@ down = pygame.image.load('down.png')
left = pygame.image.load('left.png') left = pygame.image.load('left.png')
#蛇头的初始坐标 #蛇头的初始坐标
x,y=240,120 x,y=240,120
setheading='right'
snake_head=right
poat=[(180,90),(180,120),(210,120),(x,y)] poat=[(180,90),(180,120),(210,120),(x,y)]
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -33,7 +35,7 @@ while True: ...@@ -33,7 +35,7 @@ while True:
setheading='up' setheading='up'
if event.key==locals.K_RIGHT and setheading != 'left': if event.key==locals.K_RIGHT and setheading != 'left':
setheading='right' setheading='right'
x+=30 x+=30
poat.append((x,y)) poat.append((x,y))
poat.pop(0) poat.pop(0)
......
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