Commit 8d03faa7 by BellCodeEditor

save project

parent 049e5917
Showing with 15 additions and 5 deletions
...@@ -7,9 +7,10 @@ pygame.init() ...@@ -7,9 +7,10 @@ pygame.init()
#创建窗口 #创建窗口
screen = pygame.display.set_mode((660,480)) screen = pygame.display.set_mode((660,480))
#导入图片 #导入图片
pygame.image.load('bg.png') background = pygame.image.load('bg.png')
pygame.image.load('apple.png') right = pygame.image.load('right.png')
pygame.image.load('right.png') body = pygame.image.load('body.png')
apple = pygame.image.load('apple.png')
#保留窗口(无限循环) #保留窗口(无限循环)
while True: while True:
#事件监听 #事件监听
...@@ -18,4 +19,13 @@ while True: ...@@ -18,4 +19,13 @@ while True:
if event.type == locals.QUIT: if event.type == locals.QUIT:
exit() exit()
#将背景渲染到窗口上 #将背景渲染到窗口上
pygame.surface.blit(0,0) screen.blit(background,(0,0))
\ No newline at end of file #将头部和身体渲染到窗口上
screen.blit(right,(240,120))
screen.blit(body,(210,120))
screen.blit(body,(180,120))
screen.blit(body,(180,90))
#将苹果渲染到窗口上
screen.blit(apple,(450,390))
#刷新界面
pygame.display.update()
\ 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