Commit b17cb6e1 by BellCodeEditor

save project

parent 5a23ed2a
Showing with 16 additions and 0 deletions
...@@ -4,9 +4,24 @@ from pygame import locals ...@@ -4,9 +4,24 @@ from pygame import locals
# 初始化pygame,为使用pygame做准备 # 初始化pygame,为使用pygame做准备
pygame.init() pygame.init()
# 载入图片
bg = pygame.image.load("bg.png")
snake_r = pygame.image.load("right.png")
apple = pygame.image.load("apple.png")
body = pygame.image.load("body.png")
# 创建一个窗口 # 创建一个窗口
pygame.display.set_mode((660,480)) pygame.display.set_mode((660,480))
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
exit() exit()
# 渲染图片
screen.blit(bg,(0,0))
screen.blit(snake_r,(390,180))
screen.blit(body,(360,180))
screen.blit(body,(330,180))
screen.blit(body,(330,150))
screen.blit(apple,(330,300))
# 刷新画面
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