Commit 21dcd25c by BellCodeEditor

save project

parent 6adc5d84
Showing with 5 additions and 19 deletions
......@@ -6,7 +6,7 @@ pygame.init() # 初始化
screen = pygame.display.set_mode((1000, 600))
FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
# 载入图片
pygame.bisplay.set_caption("悟空酷跑")
pygame.bispiay.set_caption("悟空酷跑")
background = pygame.image.load('bg.png') # 背景
road = pygame.image.load('road.png') # 路
stone = pygame.image.load('stone.png') # 石头
......@@ -18,30 +18,16 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
index = 0
zt="pao"
y=400
index = 0
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
if event.type==locals.KEYDOWN:
if event.key==locals.K_SPACE:
zt="up"
if zt=="up":
if y>150:
y=y-5
else:
zt="down"
if zt=="down":
if y<400:
y=y+5
else:
zt="pao"
index=index+1
if index>len(hero)-1:
index=0
# 将背景图画上去
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
......
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