Commit 471010ed by BellCodeEditor

save project

parent 23eff819
Showing with 17 additions and 6 deletions
...@@ -2,8 +2,12 @@ import pygame ...@@ -2,8 +2,12 @@ import pygame
from pygame import locals from pygame import locals
x=240 x=240
y=120 y=120
a=[(180,90),(180,120),(210,120),(x,y)]
# 初始化pygame,为使用pygame做准备 # 初始化pygame,为使用pygame做准备
pygame.init() pygame.init()
FPSCLOCK=pygame.time.Clock()
background=pygame.image.load('bg.png') background=pygame.image.load('bg.png')
right=pygame.image.load('right.png') right=pygame.image.load('right.png')
...@@ -22,14 +26,21 @@ while True: ...@@ -22,14 +26,21 @@ while True:
exit() exit()
x+=30 x+=30
a.append((x,y))
a.pop(0)
screen.blit(background,(0,0)) screen.blit(background,(0,0))
screen.blit(right,(x,y)) screen.blit(right,a[-1])
for i in range(len(a)-1):
screen.blit(body,a[i])
screen.blit(food,(60,240)) screen.blit(food,(60,240))
screen.blit(body,(210,120)) # screen.blit(body,(210,120))
screen.blit(body,(180,120)) # screen.blit(body,(180,120))
screen.blit(body,(180,90)) # screen.blit(body,(180,90))
pygame.display.update() pygame.display.update()
pygame.time.Clock.tick(3) FPSCLOCK.tick(5)
......
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