Commit 2f109045 by BellCodeEditor

save project

parent 8c84d626
Showing with 8 additions and 3 deletions
# 导入 # 导入
import pygame import pygame
from pygame import locals from pygame import locals
x,y=150,180
# 载入图片 # 载入图片
bg = pygame.image.load('bg.png') bg = pygame.image.load('bg.png')
right = pygame.image.load('right.png') right = pygame.image.load('right.png')
apple = pygame.image.load('apple.png') apple = pygame.image.load('apple.png')
body = pygame.image.load('body.png') body = pygame.image.load('body.png')
FPSCLOCK=pygame.time.Clock()
# 初始化pygame,为使用pygame做准备 # 初始化pygame,为使用pygame做准备
pygame.init() pygame.init()
# 创建一个窗口 # 创建一个窗口
srceen = pygame.display.set_mode((660,480)) srceen = 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()
x+=30
# 渲染图片 # 渲染图片
srceen.blit(bg,(0,0)) srceen.blit(bg,(0,0))
srceen.blit(right,(150,180)) srceen.blit(right,(x,y))
srceen.blit(apple,(540,420)) srceen.blit(apple,(540,420))
srceen.blit(body,(120,180)) srceen.blit(body,(120,180))
srceen.blit(body,(90,180)) srceen.blit(body,(90,180))
srceen.blit(body,(90,150)) srceen.blit(body,(90,150))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
\ No newline at end of file FPSCLOCK.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