Commit 5b129675 by BellCodeEditor

save project

parent 2a6674d9
Showing with 13 additions and 8 deletions
......@@ -14,7 +14,7 @@ apple = pygame.image.load('bush.png') # 灌木丛
hero = [pygame.image.load('hero1.png'),pygame.image.load('hero2.png'),pygame.image.load('hero3.png'),pygame.image.load('hero4.png'),pygame.image.load('hero5.png')]
index = 0
pygame.display.set_caption('酷跑')
t=30
y=400
zhuangTai="running"
......@@ -23,19 +23,24 @@ while True:
if event.type == locals.QUIT:
exit()
if event.type ==locals.KEYDOWN :
if event.key==locals.K_SPACE :
zhuangTai="up"
if zhuangTai=="running":
if event.key==locals.K_SPACE :
zhuangTai="up"
if zhuangTai=="up":
if y>150:
y-=5
if t>0:
y-=t
t-=2
else:
zhuangTai="down"
if zhuangTai=="down":
if y<400:
y+=5
if t<=30:
y+=t
t+=2
else:
zhuangTai="running"
zhuangTai="running"
t=30
......
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