Commit a2597c71 by BellCodeEditor

save project

parent e9cf493a
Showing with 11 additions and 6 deletions
......@@ -13,9 +13,10 @@ background = pygame.image.load('bg.png')
right = pygame.image.load('right.png')
food = pygame.image.load('apple.png')
body = pygame.image.load('body.png')
left=pygame.inage.load('left.pog')
up = pygame inage.load('up.pog')
left =pygame.inage.load('left.pog')
up = pygame.inage.load('up.pog')
down=pygame.inage.load('down.pog')
my_font=pygame.font.Font('neuropol.ttf')
x,y=240,120
position=[(180,90),(180,120),(210,120),(x,y)]
......@@ -26,8 +27,8 @@ sethea
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
else: # 接收到退出事件后退出程序
position.pop(0)
# 将背景图画上去
screen.blit(background, (0, 0))
# 将贪吃蛇画上去
......@@ -45,9 +46,13 @@ while True:
if x==apple_x and y==apple_y:
apple_x=random.randint(0,660)
apple_y=random.randint(0,480)
num1=random.randint(1,22)
num2=random.randint(1,12)
apple_x=num1*30-30
apple_y=num2*30-30
......
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