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