Commit 244788e0 by BellCodeEditor

save project

parent 040df244
Showing with 10 additions and 6 deletions
......@@ -15,6 +15,7 @@ hero = pygame.image.load('hero1.png')
index = 0
num = 0
jumpState = 'running'
t = 30
herolist = ['hero1.png','hero2.png','hero3.png','hero4.png','hero5.png']
y = 400
while True:
......@@ -26,16 +27,19 @@ while True:
if event.key == locals.K_SPACE and jumpState == 'running':
jumpState = "up"
if jumpState == "up": # 起跳
if y > 150:
y -= 40
if t > 0:
y -= t
t -= 2
else:
jumpState = "down"
if jumpState == "down": # 起跳
if y < 400:
y += 40
if t <= 30:
y += t
t += 2
else:
jumpState = "running"
t = 30
# 将背景图画上去
screen.blit(background, (0, 0))
......@@ -48,4 +52,4 @@ while True:
num = 0
# 刷新画面
pygame.display.update()
FPS.tick(20)
\ No newline at end of file
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