Commit a3c1b8fc by BellCodeEditor

auto save

parent 6de8de98
Showing with 24 additions and 6 deletions
......@@ -8,17 +8,35 @@ pygame.init()
beijing = pygame.image.load('bg.png')
apple = pygame.image.load('apple.png')
juese = pygame.image.load('right.png')
shenti=pygame.image.load('body.png')
# 创建一个窗口
screen=pygame.display.set_mode((1080,1361))
screen=pygame.display.set_mode((660,480))
FPS=pygame.time.Clock() #pygame时钟,设置游戏速度(帧数)
x,y =240,120
zuobiao=[(180,90),(180,120),(210,120),(x,y)]#身体和头的坐标库
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
# 退出程序
exit()
#向右走
x +=30
zuobiao.append((x,y))#增加一个头的坐标进入列表
zuobiao.pop(0)#删掉第一个坐标
#将背景画上去
screen.blit(beijing,(0,0))
screen.blit(juese,(0,0))
screen.blit(apple,(0,50))
#把头画上去
screen.blit(juese,zuobiao[-1])
#把身体画上去
for i in range(len(zuobiao)-1):
screen.blit(shenti,zuobiao[i])
#把苹果画上去
screen.blit(apple,(0,60))
#刷新画面
pygame.display.update()
\ No newline at end of file
pygame.display.update()
FPS.tick(2)
\ 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