Commit f1de9412 by BellCodeEditor

save project

parent 80b7e96d
Showing with 11 additions and 8 deletions
......@@ -23,7 +23,7 @@ y = 400
t=30
s=random.choice([stone,cacti,apple])
rect = s.get_rect()
rect.x=500
rect.x=1000
rect.y=500-rect.height
while True:
for event in pygame.event.get():
......@@ -31,7 +31,8 @@ while True:
# 接收到退出事件后退出程序
exit()
if event.type==locals.KEYDOWN:
if event.key==locals.K_SPACE and a=="running":
if a=="running":
if event.key==locals.K_SPACE:
a="up"
if a=="up":
if t>0:
......@@ -46,13 +47,13 @@ while True:
else:
a="running"
t=30
# if rect.x<0-rect.width:
# s=random.choice([stone,cacti,apple])
# rect = s.get_rect()
# rect.x=1000
# rect.y=500-rect.height
if rect.x<0-rect.width:
s=random.choice([stone,cacti,apple])
rect = s.get_rect()
rect.x=1000
rect.y=500-rect.height
rect.x-=10
screen.blit(s, (rect.x, rect.y))
wukong = hero[x]
if a=="running":
x+=1
......@@ -62,6 +63,7 @@ while True:
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(wukong, (150, y))
screen.blit(s, (rect.x, rect.y))
# 刷新画面
pygame.display.update()
FPS.tick(25)
\ 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