Commit c83048a2 by BellCodeEditor

save project

parent 3d93de93
Showing with 15 additions and 5 deletions
......@@ -9,15 +9,17 @@ sab = pygame.image.load('bg.png')
food = pygame.image.load('apple.png')
right = pygame.image.load('right.png')
body = pygame.image.load('body.png')
font = pygame.font.Font('neuropol.ttf',18)
# 创建一个窗口
sb=pygame.display.set_mode((660,480))
FPSCLOCK = pygame.time.Clock()
x, y = 240, 120
apple_x = 360
apple_y = 480
apple_y = 450
lb = [(180,90),(180,120),(210,120),(x,y)]
fx = "right"
fenshu = 0
while True:
for event in pygame.event.get():
......@@ -42,15 +44,23 @@ while True:
y += 30
#x += 30
lb.append((x,y))
lb.pop(0)
if apple_x and apple_y == x and y:
apple_x = random.randint(0,660)
apple_y = random.randint(0.480)
if apple_x == x and apple_y == y:
number1 = random.randint(1,22)
number2 = random.randint(1,16)
apple_x = number1*30-30
apple_y = number2*30-30
fenshu += 30
else:
lb.pop(0)
sb.blit(sab,(0,0))
sb.blit(right, lb[-1])
#sb.blit(right,(x,y))
#sb.blit(sab,(0,0))
sb.blit(food,(apple_x,apple_y))
info = "fenshu" + str(fenshu)
text = font.render(info,True,(0,0,0))
sb.blit(text,(540,10))
#sb.blit(right,(x,y))
for i in range(len(lb)-1):
sb.blit(body, lb[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