Commit 3410b066 by BellCodeEditor

auto save

parent c6188a1e
Showing with 23 additions and 5 deletions
import pygame import pygame
from pygame import locals
pygame.init() # 初始化pygam,为使用pygame做准备
b = pygame.image.load('bg.png') #载入背景图
s = pygame.image.load('right.png') #载入蛇头
t = pygame.image.load('body.png') #载入身体
p = pygame.image.load('apple.png') #载入苹果
screen = pygame.display.set_mode((660,480)) # 创建一个窗口
# 初始化pygame,为使用pygame做准备 f = pygame.time.Clock() #时钟,控制游戏速度
pygame.init() x,y = 240,120 #初始化蛇头坐标
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
exit()
x += 30
screen.blit(b,(0,0)) #渲染图片素材到窗口
screen.blit(s,(x,y))
screen.blit(t,(210,120))
screen.blit(t,(180,120))
screen.blit(t,(150,120))
screen.blit(p,(360,300))
# 创建一个窗口 pygame.display.flip() #刷新游戏界面
?? f.tick(3) #设置游戏帧数
\ 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