Commit a2dbc80e by BellCodeEditor

save project

parent cd151910
Showing with 15 additions and 9 deletions
...@@ -20,7 +20,7 @@ index = 0 ...@@ -20,7 +20,7 @@ index = 0
summ = 0 summ = 0
y=400 y=400
jumpState="runing" jumpState="runing"
t = 30 t=30
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
...@@ -32,23 +32,28 @@ while True: ...@@ -32,23 +32,28 @@ while True:
if jumpState=='up': if jumpState=='up':
if t>0: if t>0:
y-=t y-=t
t-=2 t -= 2
else: else:
jumpState='down' jumpState="down"
if jumpState=='down': if jumpState=="down":
if t<30: if t<=30:
y += t y += t
t += 2 t += 2
else: else:
jumpState='runing' jumpState="runing"
#wukong = hero[0] t = 30
wukong = hero[index]
if jumpState == "runing":
index += 1
if index == 5:
index = 0
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
screen.blit(road, (0, 500)) screen.blit(road, (0, 500))
screen.blit(hero[summ], (150, y)) screen.blit(wukong, (150, y))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) FPS.tick(50)
summ += 1 summ += 1
summ = summ % 5 summ = summ % 5
\ 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