Commit d4ce2f64 by BellCodeEditor

save project

parent 0ea918b5
Showing with 20 additions and 2 deletions
......@@ -18,18 +18,36 @@ pygame.image.load('hero2.png'),
pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
y=400
herostatus="running"
while True:
for event in pygame.event.get():
if event.type==locals.KEYDOWN:
if event.key==locals.K_SPACE:
if herostatus=="running":
herostatus="jumping"
print(1)
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
if herostatus=="jumping":
y=y-5
if y<150:
herostatus="down"
elif herostatus=="down":
y=y+5
if y>400:
herostatus="running"
# 将背景图画上去
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(heros[index], (150, 400))
screen.blit(heros[index], (150, y))
print(y)
index=index+1
if index>4:
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