Commit d47006d7 by BellCodeEditor

save project

parent 3daebb9f
Showing with 10 additions and 1 deletions
...@@ -15,6 +15,13 @@ right = pygame.image.load('right.png') ...@@ -15,6 +15,13 @@ 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')
myfont=pygame.font.Font('neuropol.ttf',18) myfont=pygame.font.Font('neuropol.ttf',18)
x,y=240,120
pos=[(180,90),(180,120),(210,120),(x,y)]
head='right'
tou=right
a_x=360
y_x=360
myfont=pygame.font.Font('neuropol.ttf',18)
...@@ -23,13 +30,15 @@ while True: ...@@ -23,13 +30,15 @@ while True:
if event.type == locals.QUIT: if event.type == locals.QUIT:
# 接收到退出事件后退出程序 # 接收到退出事件后退出程序
exit() exit()
if x==a_x and y==_y: if x==a_x and y==_y:
a_x=random.randint(0,21)*30 a_x=random.randint(0,21)*30
a_x=random.randint(0,15)*30 a_x=random.randint(0,15)*30
score+=1 score+=1
else: else:
pos.pop(0) pos.pop(0)
if x<0 or x>630 or y<0 or y>450 if x<0 or x>630 or y<0 or y>450:
exit()
# 将背景图画上去 # 将背景图画上去
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