Commit 92c7bc5a by BellCodeEditor

save project

parent 0d4cc6e1
Showing with 9 additions and 7 deletions
...@@ -25,10 +25,11 @@ while True: ...@@ -25,10 +25,11 @@ while True:
if event.type == locals.QUIT: if event.type == locals.QUIT:
# 接收到退出事件后退出程序 # 接收到退出事件后退出程序
exit() exit()
if event.type==locals.KEYDOWN: if event.type==locals.KEYDOWN:
if event.key==locals.K_SPACE: if jump=="running":
jump="UP" if event.key==locals.K_SPACE:
jump="UP"
if jump=="UP": if jump=="UP":
if t>0: if t>0:
y-=t y-=t
...@@ -36,7 +37,7 @@ while True: ...@@ -36,7 +37,7 @@ while True:
else: else:
jump="down" jump="down"
if jump=="down": if jump=="down":
if t<30: if t<=30:
y+=t y+=t
t+=2 t+=2
else: else:
...@@ -45,9 +46,10 @@ while True: ...@@ -45,9 +46,10 @@ while True:
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
screen.blit(road, (0, 500)) screen.blit(road, (0, 500))
Q+=1 if jump=="running":
if Q>4: Q+=1
Q=0 if Q>4:
Q=0
screen.blit(hero[Q], (150, y)) screen.blit(hero[Q], (150, y))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
......
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