Commit d036794b by BellCodeEditor

save project

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