Commit 1a80303f by BellCodeEditor

save project

parent fc98777c
Showing with 8 additions and 5 deletions
...@@ -26,6 +26,7 @@ z=random.choice([stone,cacti,apple]) ...@@ -26,6 +26,7 @@ z=random.choice([stone,cacti,apple])
rect=z.get_rect() rect=z.get_rect()
rect.x=1000 rect.x=1000
rect.y=500-rect.height rect.y=500-rect.height
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:
...@@ -37,13 +38,15 @@ while True: ...@@ -37,13 +38,15 @@ while True:
jumpstate="up" jumpstate="up"
if jumpstate=="up": if jumpstate=="up":
if y>150: if t>0:
y=y-5 y-=t
t=t-2
else: else:
jumpstate="down" jumpstate="down"
if jumpstate=="down": if jumpstate=="down":
if y<400: if t<=30:
y=y+5 y+=t
t+=2
else: else:
jumpstate="runing" jumpstate="runing"
...@@ -52,7 +55,7 @@ while True: ...@@ -52,7 +55,7 @@ while True:
m=m+1 m=m+1
if m>4: if m>4:
m=0 m=0
t=30
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
screen.blit(road, (0, 500)) 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