Commit 53cc4f2a by BellCodeEditor

auto save

parent 9cd1800b
Showing with 15 additions and 23 deletions
import pygame import pygame
from pygame import locals from pygame import locals
# 初始化pygame,为使用pygame做准备 # 初始化pygame,为使用pygame做准备
pygame.init() pygame.init()
#加载背景、蛇头、苹果
bg =pygame.image.load('bg.png')
head = pygame.image.load('right.png')
apple = pygame.image.load('apple.png')
body = pygame.image.load('body.png')
#创建舞台
screen = pygame.display.set_mode((660,480))
# 创建一个窗口
screen = pygame.display.set_mode((800,600))
#导入所有的素材
background = pygame.image.load('bg.png') #背景
right = pygame.image.load('right.png') #头
food = pygame.image.load('apple.png') #食物
body = pygame.image.load('body.png') #身体
#实现一直显示窗口
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(background,(0,0)) screen.blit(bg,(0,0))
#头 screen.blit(head,(240,120))
screen.blit(right,(240,120)) screen.blit(apple,(360,300))
#身体 screen.blit(body,(,))
screen.blit(body,(210,120)) #刷新舞台
screen.blit(body,(180,120)) pygame.display.update()
screen.blit(body,(180,90))
#食物
screen.blit(food,(360,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