Commit 242cc201 by BellCodeEditor

save project

parent 022ec8df
Showing with 23 additions and 18 deletions
import pygame import pygame
from pygame import locals from pygame import locals
pygame.init() # 初始化 pygame.init()
# 创建一个窗口
screen = pygame.display.set_mode((1000, 600)) screen = pygame.display.set_mode((1000,600))
FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数) pygame.display.set_caption('额我的回答i2额u好的好的2欸偶还得u 华为陌好欸一一 iueh23 好3iuh3 iuh3iu3 虎 还 一和i汇入瑞额u海域 23 3让 io23晕ueji')
# 载入图片 FPS = pygame.time.Clock()
background = pygame.image.load('bg.png') # 背景
road = pygame.image.load('road.png') # 路 background = pygame.image.load('bg.png')
stone = pygame.image.load('stone.png') # 石头 road = pygame.image.load('road.png')
cacti = pygame.image.load('cacti.png') # 仙人掌 stone = pygame.image.load('stone.png')
apple = pygame.image.load('bush.png') # 灌木丛 cacti = pygame.image.load('cacti.png')
hero = pygame.image.load('hero1.png') apple = pygame.image.load('bush.png')
index = 0 hero = [pygame.image.load('hero5.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero3.png'),
pygame.image.load('hero2.png'),
pygame.image.load('hero1.png')]
i = 0
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(background, (0, 0)) screen.blit(road,(0,500))
screen.blit(road, (0, 500)) screen.blit(hero[i%5],(150,400))
screen.blit(hero, (150, 400)) i += 1
# 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(60) FPS.tick(60)
\ 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