Commit 1824d051 by BellCodeEditor

auto save

parent 2813a81f
Showing with 5 additions and 3 deletions
...@@ -2,18 +2,20 @@ import pygame ...@@ -2,18 +2,20 @@ import pygame
from pygame import locals from pygame import locals
food = pygame.image.load('apple.png')#食物 苹果 food = pygame.image.load('apple.png')#食物 苹果
backgroud = pygame.image.load('bg.png')#背景图 backgroud = pygame.image.load('bg.png')#背景图
right = pygame.image.load('right')#蛇头
body = pygame.image.load('body.png')#
# 初始化pygame,为使用pygame做准备 # 初始化pygame,为使用pygame做准备
pygame.init() pygame.init()
# 创建一个窗口 # 创建一个窗口
screen = pygame.display.set_mode((660,480)) screen = pygame.display.set_mode((660,480))
while True: while True:
for event in py.game.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
#接受到退出事件后退出程序 #接受到退出事件后退出程序
exit() exit()
screen.blit(backgroud,(0,0))#背景 screen.blit(backgroud,(0,0))#背景
screen.blit(food,(360,300))#苹果 screen.blit(food,(360,300))#苹果
screen.blit(right,(24,120))#蛇头 screen.blit(right,(360,300))#蛇头
screen.blit(body,(360,300))#蛇身体
pygame.display.update() pygame.display.update()
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