Commit 32219c87 by BellCodeEditor

save project

parent 67750d23
Showing with 20 additions and 1 deletions
......@@ -19,21 +19,39 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero5.png')]
m = 0
j="runing"
y=400
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
if event.type==locals.KEYDOWN:
if event.key==locals.K_SPACE:
if j =="runing":
j="up"
if j =="up":
if y >150:
y=y-5
else:
j="down"
if j=="down":
if y<400:
y=y+5
else:
j="runing"
hero1=hero[m]
if j=="runing":
m+=1
if m>4:
m=0
# 将背景图画上去
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(hero1, (150, 400))
screen.blit(hero1, (150, y))
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ 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