Commit 039fd8b8 by BellCodeEditor

save project

parent 4f601081
Showing with 10 additions and 3 deletions
......@@ -4,11 +4,13 @@ import random
# 初始化pygame,为使用硬件做准备
pygame.init()
Score=0
# 创建一个窗口
screen = pygame.display.set_mode((660, 480))
FPSCLOCK = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
# 背景
background = pygame.image.load('bg.png')
right = pygame.image.load('right.png') # 头 朝右
......@@ -60,6 +62,10 @@ while True:
apple_x=random.randint(1,22)*30-30
apple_y=random.randint(1,16)*30-30
position.insert(0,(position[0]))
scare+=10
if x > 0 or x > 450 or y > 0 or y > 630
exit()
# 将背景图画上去
......@@ -69,10 +75,12 @@ while True:
# 将贪吃蛇的身体画上去
for i in range(len(position)-1):
screen.blit(body, position[i])
my_font=pygame.font.Font("neuropol.ttf",18)
info="scare"+str(scare)
text=my_font.render(info,troe,(10,0,21))
screen.blit,(540,10)
# 将果实画上去
screen.blit(food,(apple_x,apple_y))
# 刷新画面
pygame.display.update()
FPSCLOCK.tick(3)
\ No newline at end of file
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