Commit 13de08c2 by BellCodeEditor

save project

parent 342d7e59
Showing with 19 additions and 4 deletions
...@@ -16,7 +16,9 @@ pygame.image.load('hero2.png'), ...@@ -16,7 +16,9 @@ pygame.image.load('hero2.png'),
pygame.image.load('hero3.png'), pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'), pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')] pygame.image.load('hero5.png')]
lll=0
index = 0 index = 0
y=400
kun=hero[index] kun=hero[index]
while True: while True:
...@@ -24,16 +26,29 @@ while True: ...@@ -24,16 +26,29 @@ while True:
if event.type == locals.QUIT: if event.type == locals.QUIT:
# 接收到退出事件后退出程序 # 接收到退出事件后退出程序
exit() exit()
if event.type == locals.KEYUP:
lll=1
y-=20
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
screen.blit(road, (0, 500)) screen.blit(road, (0, 500))
screen.blit(kun,(150, 400)) screen.blit(kun,(150, y))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(20) FPS.tick(60)
index+=1 index+=1
if index==5: if index==5:
index=0 index=0
kun=hero[index] kun=hero[index]
if lll == 1:
\ No newline at end of file if y<400 and y>200:
y-=20
else:
lll=2
if lll==2:
if y <400:
y+=20
else:
lll=0
y=400
\ 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