Commit c663acdf by BellCodeEditor

save project

parent dea822c0
Showing with 13 additions and 3 deletions
......@@ -17,6 +17,7 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
y = 400
index = 0
zt = "pao"
......@@ -28,8 +29,16 @@ while True:
if event.type == locals.KEYDOWN:
if event.key == locals.K_SPACE:
zt = "up"
if zt=="up:"
if zt=="up":
if y>150:
y = y - 5
else:
zt = "down"
if zt == "down":
if y<400:
y = y + 5
else:
zt = "pao"
index = index + 1
......@@ -38,7 +47,7 @@ while True:
# 将背景图画上去
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(hero[index], (150, 400))
screen.blit(hero[index], (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