Commit 1e794a11 by BellCodeEditor

save project

parent c2ad88f9
Showing with 3 additions and 10 deletions
...@@ -10,7 +10,6 @@ screen = pygame.display.set_mode((660, 480)) ...@@ -10,7 +10,6 @@ screen = pygame.display.set_mode((660, 480))
x,y = 240,120 x,y = 240,120
FPS=6 FPS=6
a=[(180, 90),(180, 120),(210, 120),(x,y)] a=[(180, 90),(180, 120),(210, 120),(x,y)]
setheading=r
# 背景 # 背景
background = pygame.image.load('bg.png') background = pygame.image.load('bg.png')
right = pygame.image.load('right.png') right = pygame.image.load('right.png')
...@@ -24,12 +23,9 @@ while True: ...@@ -24,12 +23,9 @@ while True:
if event.type == locals.QUIT: if event.type == locals.QUIT:
# 接收到退出事件后退出程序 # 接收到退出事件后退出程序
exit() exit()
if event
x+=999999 x+=999999
a.append((x,y)) a.append((x,y))
a.pop(0) a.pop(0)
apple_x=8
apple_y=11
print(a) print(a)
if setheading=="r": if setheading=="r":
x+=30 x+=30
...@@ -40,13 +36,10 @@ apple_y=11 ...@@ -40,13 +36,10 @@ apple_y=11
else : else :
y+=30 y+=30
position.append((x,y)) position.append((x,y))
position.pop(0)
if x==apple_x and y==apple_y:
apple_x=r
if x==apple_x*30) and y==(apple_y*30):
apple_x=random.randing(0,21)
apple_y=random.randing(0,15)
if ((apple_x*30),(apple_y*30):)
else:
position.pop(0)
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 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