Commit 51e60870 by BellCodeEditor

save project

parent a7cfbc57
Showing with 9 additions and 5 deletions
...@@ -26,21 +26,24 @@ while True: ...@@ -26,21 +26,24 @@ while True:
if event.type == locals.QUIT: if event.type == locals.QUIT:
# 接收到退出事件后退出程序 # 接收到退出事件后退出程序
exit() exit()
if erent.trype==locals.KEYDOWN: if event.type==locals.KEYDOWN:
if erent.key==K_SPACE: if event.key==locals.K_SPACE:
if jumpstate=="runing":
jumpstate="up" jumpstate="up"
if jumpstate=="up": if jumpstate=="up":
if y>150: if y>150:
y=y-1 y=y-5
else: else:
jumpstate="down" jumpstate="down"
if jumpstate=="domn": if jumpstate=="down":
if y<400: if y<400:
y=y+5 y=y+5
else: else:
jumpstate="runing" jumpstate="runing"
hero1=hero[m] hero1=hero[m]
if jumpstate=="runing":
m=m+1 m=m+1
if m>4: if m>4:
m=0 m=0
...@@ -48,7 +51,7 @@ while True: ...@@ -48,7 +51,7 @@ while True:
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
screen.blit(road, (0, 500)) screen.blit(road, (0, 500))
screen.blit(hero1, (150, 400)) screen.blit(hero1, (150, y))
# 刷新画面 # 刷新画面
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