Commit fee68c94 by BellCodeEditor

save project

parent 8c03c140
Showing with 19 additions and 8 deletions
...@@ -21,6 +21,7 @@ index = 0 ...@@ -21,6 +21,7 @@ index = 0
pygame.display.set_caption("悟空酷跑") pygame.display.set_caption("悟空酷跑")
c="run" c="run"
y=400 y=400
t=30
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
...@@ -28,20 +29,30 @@ while True: ...@@ -28,20 +29,30 @@ while True:
exit() exit()
if event.type==locals.KEYDOWN: if event.type==locals.KEYDOWN:
if event.key==locals.K_SPACE: if event.key==locals.K_SPACE:
c="up" if c=="run":
c="up"
if c=="up": if c=="up":
if y>150: if t>0:
y=y-5 y=y-t
t=t-2
else: else:
c="down" c="down"
if c=="down": if c=="down":
if y<400: if t<=30:
y=y+5 y=y+t
t=t+2
else: else:
c="run" c="run"
a=a+1 t=30
if a==5: print (y)
a=0 print(t)
if c=="up" or c=="down":
pass
else:
a=a+1
if a==5:
a=0
b=hero[a] b=hero[a]
# 将背景图画上去 # 将背景图画上去
......
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