Commit eb56baaf by BellCodeEditor

auto save

parent 0fd8c024
Showing with 4 additions and 5 deletions
...@@ -10,7 +10,7 @@ class Block(pygame.sprite.Sprite): ...@@ -10,7 +10,7 @@ class Block(pygame.sprite.Sprite):
self.rect.x=1000 self.rect.x=1000
self.rect.y=500-self.rect.height self.rect.y=500-self.rect.height
class player(pygame.sprite.Sprite): class player(pygame.sprite.Sprite):
def__init__(self,image): def __init__(self,image):
super().__init__() super().__init__()
self.image = image self.image = image
self.rect = self.image.get_rect() self.rect = self.image.get_rect()
...@@ -49,10 +49,9 @@ while True: ...@@ -49,10 +49,9 @@ while True:
if jumpState == "runing": if jumpState == "runing":
if event.key == locals.K_SPACE: if event.key == locals.K_SPACE:
jumpState = "up" jumpState = "up"
if
if jumpState == "up": # 起跳状态 if jumpState == "up": # 起跳状态
if t > 0: if t > 0:
wukong.y = y y-= t
t -= 2 t -= 2
else: else:
jumpState = "down" jumpState = "down"
...@@ -65,7 +64,7 @@ while True: ...@@ -65,7 +64,7 @@ while True:
t =30 t =30
# 悟空造型 # 悟空造型
wukong = player([index]) wukong = player(hero[index])
if jumpState == "runing": # 跑步状态下 if jumpState == "runing": # 跑步状态下
index += 1 index += 1
if index >= 5: if index >= 5:
...@@ -79,7 +78,7 @@ while True: ...@@ -79,7 +78,7 @@ while True:
if lu_x <-1000: if lu_x <-1000:
lu_x=0 lu_x=0
screen.blit(road, (lu_x, 500)) # 路 screen.blit(road, (lu_x, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空 screen.blit(wukong.image, (150, y)) # 悟空
if obstacle.rect.x <= 0-obstacle.rect.width: # 障碍物消失 if obstacle.rect.x <= 0-obstacle.rect.width: # 障碍物消失
# 创建障碍物对象 # 创建障碍物对象
......
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