Commit fe2234f9 by BellCodeEditor

save project

parent 95b1e684
Showing with 24 additions and 2 deletions
...@@ -6,6 +6,14 @@ pygame.init() ...@@ -6,6 +6,14 @@ pygame.init()
# 创建一个窗口 # 创建一个窗口
Screen = pygame.display.set_mode((660,480)) Screen = pygame.display.set_mode((660,480))
#载入背景图片
bg = pygame.image.load("bg.png")
#载入蛇头图片
right = pygame.image.load("right.png")
#载入身体图片
body = pygame.image.load("body.png")
#载入苹果图片
apple = pygame.image.load("apple.png")
#无限循环让窗口一直保留 #无限循环让窗口一直保留
while True: while True:
...@@ -14,4 +22,18 @@ while True: ...@@ -14,4 +22,18 @@ while True:
#如果按下了窗口的退出按键 #如果按下了窗口的退出按键
if event.type == locals.QUIT: if event.type == locals.QUIT:
#退出程序 #退出程序
exit() exit()
\ No newline at end of file
#加载背景图片
Screen.blit(bg,(0,0))
#加载蛇头
Screen.blit(right,(180,120))
#加载身体
Screen.blit(body,(150,120))
Screen.blit(body,(120,120))
Screen.blit(body,(120,90))
#加载苹果
Screen.blit(apple,(450,360))
#实时刷新画面
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