Commit e248547a by BellCodeEditor

save project

parent de89f609
Showing with 23 additions and 1 deletions
......@@ -19,16 +19,38 @@ hero5 = pygame.image.load('hero5.png')
hero=[hero1,hero2,hero3,hero4,hero5]
wukong=hero[0]
index = 0
jumpState="running"
t=30
y=400
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:
jumpState="up"
if jumpState=="up":
if y>150:
y-=t
t-=2
else:
t=0
jumpState="down"
if jumpState=="down":
if y<400:
y+=t
t+=2
else:
jumpState="running"
wukong=hero[index]
index+=1
if index>4:
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