Commit f17fc4e6 by BellCodeEditor

save project

parent d3f4bab4
Showing with 6 additions and 12 deletions
...@@ -16,8 +16,8 @@ class Block(pygame.sprite.Sprite): ...@@ -16,8 +16,8 @@ class Block(pygame.sprite.Sprite):
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,image1,image2,image3): def _init_(self,image1,image2,image3):
super().__init__() super()._init_()
self.image = image self.image = image
...@@ -50,7 +50,6 @@ rect.y = 500 - rect.height ...@@ -50,7 +50,6 @@ rect.y = 500 - rect.height
bg_x = 0 bg_x = 0
road_x = 0 road_x = 0
gamestate = Ture
#obstacle = Block(bush,cacti,stone) #obstacle = Block(bush,cacti,stone)
block_list = pygame.sprite.Group() block_list = pygame.sprite.Group()
...@@ -65,11 +64,10 @@ while True: ...@@ -65,11 +64,10 @@ while True:
if event.key == locals.K_SPACE: if event.key == locals.K_SPACE:
jumpState = "up" jumpState = "up"
if gamestate == Ture: if jumpState == "up": # 起跳状态
if jumpState == "up": # 起跳状态 if t > 0:
if t > 0: y -= t
y -= t t -= 2
t -= 2
else: else:
jumpState = "down" jumpState = "down"
if jumpState == "down": # 降落状态 if jumpState == "down": # 降落状态
...@@ -100,10 +98,6 @@ while True: ...@@ -100,10 +98,6 @@ while True:
screen.blit(prop.image,(prop.rect.x,prop.rect.y)) screen.blit(prop.image,(prop.rect.x,prop.rect.y))
if prop.rect.x<=0-prop.rect.winth: if prop.rect.x<=0-prop.rect.winth:
prop.kill() prop.kill()
if pygame.sprite.collide_rect(wukong,sprite):
gameover = pygame.imgae.load("gameover.png")
screen.blit(gameover,(400,200))
gamestate = False
obstacle = random.choice([bush,stone,cacti]) obstacle = random.choice([bush,stone,cacti])
......
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