Commit 6a3e6ab9 by BellCodeEditor

save project

parent 7fd4d1af
Showing with 12 additions and 6 deletions
......@@ -13,25 +13,31 @@ stone = pygame.image.load('stone.png') # 石头
cacti = pygame.image.load('cacti.png') # 仙人掌
apple = pygame.image.load('bush.png') # 灌木丛
hero = pygame.image.load('hero1.png')
index = 0
t=30
rondomNum = random.choice([stone,cacti,apple])
rondomRect = rondomNum.get_rect()
rondomRect.x=1000
rondomRect.y=500-rondomRect.height
road_x=0
bg_x=0
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
road_x-=8
if road_x<=-1000:
road_x=0
bg_x-=2
if bg_x<=-1000:
bg_x=0
# 将背景图画上去
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(background, (bg_x, 0))
screen.blit(road, (road_x, 500))
screen.blit(hero, (150, 400))
if rondomRect.x<0-rondomRect.width:
rondomNum = random.choice([stone,cacti,apple])
......
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