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