Commit a49e1ab1 by BellCodeEditor

auto save

parent 95c38dc0
Showing with 33 additions and 28 deletions
......@@ -32,6 +32,7 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
lose = pygame.image.load('gameover.png')
lu_x=0
shan_x=0
index = 0
......@@ -40,6 +41,7 @@ jumpState = "runing"
t = 30
time = 0
s_list = pygame.sprite.Group()
game_state = True
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -72,31 +74,34 @@ while True:
jumpState = "runing"
t =30
# 将背景图画上去
shan_x -=2
if shan_x <-1000:
shan_x=0
screen.blit(background, (shan_x, 0)) # 远处背景
lu_x -=8
if lu_x <-1000:
lu_x=0
screen.blit(road, (lu_x, 500)) # 路
screen.blit(wukong.image, (150, wukong.rect.y)) # 悟空
if game_state:
# 将背景图画上去
shan_x -=2
if shan_x <-1000:
shan_x=0
screen.blit(background, (shan_x, 0)) # 远处背景
lu_x -=8
if lu_x <-1000:
lu_x=0
screen.blit(road, (lu_x, 500)) # 路
screen.blit(wukong.image, (150, wukong.rect.y)) # 悟空
time += 1
if time > 60:
time = 0
num = random.randint(0,50)
if num > 20:
aa=Block(bush,cacti,stone)
s_list.add(aa)
for i in s_list:
if i.rect.x <= 0-i.rect.width:
i.kill()
i.rect.x -= 8
screen.blit(i.image, (i.rect.x, i.rect.y))
if pygame
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ No newline at end of file
time += 1
if time > 60:
time = 0
num = random.randint(0,50)
if num > 20:
aa=Block(bush,cacti,stone)
s_list.add(aa)
for i in s_list:
if i.rect.x <= 0-i.rect.width:
i.kill()
i.rect.x -= 8
screen.blit(i.image, (i.rect.x, i.rect.y))
if pygame.sprite.collide_rect(wukong,i):
screen.blit(lose, (400, 300))
game_state = False
# 刷新画面
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