Commit 53cc4f2a by BellCodeEditor

auto save

parent 9cd1800b
Showing with 15 additions and 23 deletions
import pygame
from pygame import locals
# 初始化pygame,为使用pygame做准备
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:
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,(240,120))
#身体
screen.blit(body,(210,120))
screen.blit(body,(180,120))
screen.blit(body,(180,90))
#食物
screen.blit(food,(360,300))
#刷新画面
pygame.display.update()
\ No newline at end of file
screen.blit(bg,(0,0))
screen.blit(head,(240,120))
screen.blit(apple,(360,300))
screen.blit(body,(,))
#刷新舞台
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