Commit b0b44c4c by BellCodeEditor

save project

parent 09116466
Showing with 5 additions and 4 deletions
...@@ -18,7 +18,7 @@ hero = [pygame.image.load('hero1.png'), ...@@ -18,7 +18,7 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero4.png'), pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')] pygame.image.load('hero5.png')]
index = 0 index = 0
jumpstate = "running" jumpstate = "runing"
y=400 y=400
t=30 t=30
while True: while True:
...@@ -27,8 +27,9 @@ while True: ...@@ -27,8 +27,9 @@ while True:
# 接收到退出事件后退出程序 # 接收到退出事件后退出程序
exit() exit()
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if event.key == locals.K_SPACE: if jumpstate=="runing":
jumpstate = "up" if event.key == locals.K_SPACE:
jumpstate = "up"
if jumpstate == "up": if jumpstate == "up":
if t>0: if t>0:
y-=t y-=t
...@@ -40,7 +41,7 @@ while True: ...@@ -40,7 +41,7 @@ while True:
y+=t y+=t
t+=2 t+=2
else: else:
jumpstate = "running" jumpstate = "runing"
t=30 t=30
wukong = hero[index] wukong = hero[index]
......
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