Commit a0c08295 by BellCodeEditor

save project

parent 429eb1b1
Showing with 6 additions and 6 deletions
......@@ -17,7 +17,7 @@ up = pygame.image.load('up.png')
x,y = 240,120
list=[(180,90),(180,120),(210,120),(x,y)]
touch='right'
touch1 = right
touchp = right
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -26,16 +26,16 @@ while True:
elif event.type == locals.KEYDOWN:
if event.key == locals.K_RIGHT and touch != 'left':
touch = 'right'
touch1 = right
touchp = right
if event.key == locals.K_LEFT and touch != 'right':
touch = 'left'
touch1 = left
touchp = left
if event.key == locals.K_UP and touch != 'down':
touch = 'up'
touch1 = down
touchp = up
if event.key == locals.K_DOWN and touch != 'up':
touch = 'down'
touch1 = up
touchp = down
list.append((x,y))
list.pop(0)
if touch == 'right':
......@@ -49,7 +49,7 @@ while True:
# 将背景图画上去
screen.blit(background, (0, 0))
# 将贪吃蛇画上去
screen.blit(right,list[-1])
screen.blit(touchp,list[-1])
# 将贪吃蛇的身体画上去
for i in range(len(list)-1):
screen.blit(body,list[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