Commit 5112312a by BellCodeEditor

auto save

parent 8beb09f3
Showing with 22 additions and 1 deletions
......@@ -2,10 +2,30 @@ import pygame
from pygame import locals
# 初始化pygame,为使用pygame做准备
pygame.init()
#载入图片
background=pygame.image.load("bg.png")
right=pygame.image.load("right.png")
left=pygame.image.load("left.png")
up=pygame.image.load("up.png")
down=pygame.image.load("down.png")
body=pygame.image.load("body.png")
apple=pygame.image.load("apple.png")
# 创建一个窗口
screen=pygame.display.set_mode((660,480))
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
if event.type == locals.QUIT:#接收到退出事件后退出程序
exit()
#将背景图渲染到窗口上
screen.blit(background,(0,0))
#将蛇图渲染到窗口上
screen.blit(right,(540,390))
screen.blit(body,(510,390))
screen.blit(body,(480,390))
screen.blit(body,(480,360))
#将苹果图渲染到窗口上
screen.blit(apple,(600,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