Commit 14ee5012 by BellCodeEditor

save project

parent 3dc8ec7e
Showing with 14 additions and 9 deletions
......@@ -18,6 +18,7 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero5.png')]
index = 0
y = 400
t = 30
seat = 'running'
while True:
for event in pygame.event.get():
......@@ -26,21 +27,25 @@ while True:
exit()
if event.type == locals.KEYDOWN:
if event.key == locals.K_SPACE:
seat = 'up'
if seat == 'running':
seat = 'up'
if seat == 'up':
if y > 150:
y -= 5
if t > 0:
y -= t
t -= 2
else:
seat = 'down'
if seat == 'down':
if y < 400:
y += 5
if t <= 30:
y += t
t += 2
else:
seat = 'running'
t = 30
# 将背景图画上去
wukong = hero[index]
index += 1
if seat == 'running':
index += 1
if index >= 5:
index = 0
screen.blit(background, (0, 0))
......@@ -48,4 +53,4 @@ while True:
screen.blit(wukong, (150, y))
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ No newline at end of file
FPS.tick(30)
\ 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