Commit ac01d48a by BellCodeEditor

save project

parent 86333fe7
Showing with 21 additions and 5 deletions
......@@ -18,6 +18,10 @@ index = 0
y = 400
zt = "pb"
t = 30
zaw=random.choice([stone,cacti,apple])
rect=zaw.get_rect()
rect.x=1000
rect.y=500-rect.height
while True:
for event in pygame.event.get():
......@@ -29,16 +33,20 @@ while True:
if event.key==locals.K_SPACE:
zt="up"
if zt=="up":
if y>150:
y-=5
if t>0:
y-=t
t-=2
else:
zt="down"
if zt=="down":
if y<400:
y+=5
if t<30:
y+=t
t+=2
else:
zt="pb"
t=30
y=400
if zt == "pb":
wuplay=hero[index]
index+=1
if index==5:
......@@ -48,5 +56,12 @@ while True:
screen.blit(road, (0, 500))
screen.blit(wuplay, (150, y))
# 刷新画面
if rect.x<0:
zaw=random.choice([stone,cacti,apple])
rect=zaw.get_rect()
rect.x=1000
rect.y=500-rect.height
rect.x-=10
screen.blit(zaw,(rect.x,rect.y))
pygame.display.update()
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