Commit 2ba12fe5 by BellCodeEditor

save project

parent e30a34a8
Showing with 16 additions and 8 deletions
......@@ -14,6 +14,7 @@ apple = pygame.image.load('bush.png') # 灌木丛
hero =[pygame.image.load('hero1.png'),pygame.image.load('hero2.png'),pygame.image.load('hero3.png'),pygame.image.load('hero4.png'),pygame.image.load('hero5.png')]
index = 0
jp="run"
t = 30
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -21,18 +22,25 @@ while True:
exit()
if event.type == locals.KEYDOWN:
if event.key==locals.K_SPACE:
jp="up"
if jp =="run":
jp="up"
if jp=="up":
if y > 150:
y -= 10
if t>0:
y -= t
t -=2
else:
jp="down"
if jp == "down":
if y < 400:
y += 10
index+=1
if index > 4:
index = 0
if t<=30:
y += t
t +=2
else:
jp="run"
t = 30
if jp =="run":
index+=1
if index > 4:
index = 0
# 将背景图画上去
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
......
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