Commit 30e91309 by BellCodeEditor

save project

parent 636b54a3
Showing with 27 additions and 3 deletions
......@@ -5,8 +5,33 @@ from pygame import locals
pygame.init()
# 创建一个窗口
screen = pygame.display.set_mode((640,480))
screen = pygame.display.set_mode((800,600))
#载入图片
background = pygame.image.load('bg.png')
right = pygame.image.load('right.png')
apple = pygame.image.load('apple.png')
body = pygame.image.load('body.png')
#设置计时器
FPSCLOCK = pygame.time.Clock()
#设置蛇头初始位置
x , y = 210 , 150
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
exit()
\ No newline at end of file
exit()
x += 30
#图片渲染
screen.blit(background,(0,0))
screen.blit(right,(x,y))
screen.blit(apple,(390,300))
screen.blit(body,(180,150))
screen.blit(body,(150,150))
screen.blit(body,(120,150))
#刷新窗口
pygame.display.update()
#窗口刷新频率,数值越大越快
FPSCLOCK.tick(3)
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