Commit 2c6271dc by BellCodeEditor

save project

parent 0f46891a
Showing with 8 additions and 8 deletions
......@@ -13,7 +13,7 @@ background = pygame.image.load('bg.png') # 背景
road = pygame.image.load('road.png') # 路
stone = pygame.image.load('stone.png') # 石头
cacti = pygame.image.load('cacti.png') # 仙人掌
apple = pygame.image.load('bush.png') # 灌木丛
bush = pygame.image.load('bush.png') # 灌木丛
hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero2.png'),
pygame.image.load('hero3.png'),
......@@ -26,7 +26,7 @@ jumpState='run'
os=random.choice([stone,cacti,bush])
rect=os.get_rect()
rect.x=1000
rect.y=500-rect.height
rect.y = 500 - rect.height
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -59,12 +59,12 @@ while True:
index=0
if rect.x < 0-rect.width:
os = choice([stone,cacti,bush])
os = random.choice([stone, cacti, bush])
rect=os.get_rect()
rect.x=1000
rect.y=500-=rect.height
rect.x-=8
screen.blit(os, (rect.x, rect.y))
rect.y=500-rect.height
rect.x -= 8
screen.blit(os ,(rect.x, rect.y))
# 将背景图画上去
screen.blit(background, (0, 0))
......@@ -72,4 +72,4 @@ while True:
screen.blit(wukong, (150,y))
# 刷新画面
pygame.display.update()
FPS.tick(20)
\ No newline at end of file
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