Commit d036794b by BellCodeEditor

save project

parent 571a12c2
Showing with 15 additions and 8 deletions
...@@ -15,7 +15,9 @@ hero = [pygame.image.load('hero1.png'),pygame.image.load('hero2.png'),pygame.ima ...@@ -15,7 +15,9 @@ hero = [pygame.image.load('hero1.png'),pygame.image.load('hero2.png'),pygame.ima
index = 0 index = 0
pygame.display.set_caption("悟空跑酷") pygame.display.set_caption("悟空跑酷")
y=400 y=400
wy=0
j="run" j="run"
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:
...@@ -24,22 +26,27 @@ while True: ...@@ -24,22 +26,27 @@ while True:
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if event.key == locals.K_SPACE: if event.key == locals.K_SPACE:
j="up" j="up"
if j=='up': if j=='up':
if y>150: if t>0:
y-=10 y-=t
t-=2
else: else:
j="down" j="down"
if j=="down": if j=="down":
if y<400: if t<=30:
y+=10 y+=t
t+=2
else: else:
j="run" j="run"
t=30
wukong=hero[index] wukong=hero[index]
if j=="run":
index=index+1 index=index+1
if index>=5: if index==5:
index=0 index=0
# 将背景图画上去 # 将背景图画上去
......
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