Commit bb001d5c by BellCodeEditor

save project

parent 21491e9e
Showing with 14 additions and 8 deletions
......@@ -17,7 +17,7 @@ hero=[pygame.image.load('hero1.png'),
index = 0
y=400
j="running"
t=30
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -26,25 +26,31 @@ while True:
if event.type == locals.KEYDOWN:
if event.key == locals.K_SPACE:
j="up"
wukong=hero[index]
index+=1# 将背景图画上去
if index==5:
index=0
if j=="up":
if y>150:
y-=5
if t>0:
y-=t
t-=2
screen.blit(wukong, (150, y))
else:
j="down"
if j=="down":
if y<400:
y+=5
y+=t
t+=2
screen.blit(wukong, (150, y))
else:
jump="rinning"
jump="rining"
t=30
wukong=hero[index]
index+=1
if index==5:
index=0
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(wukong, (150, y))
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ No newline at end of file
FPS.tick(30)
\ 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