Commit 60d41f98 by BellCodeEditor

save project

parent 73f8d9a0
Showing with 7 additions and 5 deletions
...@@ -12,7 +12,8 @@ class Block(pygame.sprite.Sprite): ...@@ -12,7 +12,8 @@ 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
self.socre = 1 self.socre = 1
gamestate=True
bg_x=0
class Player(pygame.sprite.Sprite): class Player(pygame.sprite.Sprite):
def __init__(self,image): def __init__(self,image):
super().__init__() super().__init__()
...@@ -36,7 +37,7 @@ hero = [pygame.image.load('hero1.png'), ...@@ -36,7 +37,7 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero4.png'), pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')] pygame.image.load('hero5.png')]
score_audio=pygame.mixer.Sound('score.wav') score_audio=pygame.mixer.Sound('score.wav')
basic_font=pygame.font.Font('STKAITI.TTF'.18) basic_font=pygame.font.Font('STKAITI.TTF',18)
index = 0 index = 0
y=400 y=400
...@@ -47,6 +48,7 @@ bg_x=0 ...@@ -47,6 +48,7 @@ bg_x=0
time=0 time=0
gametaste=True gametaste=True
score=0 score=0
road_x=0
old_score=score old_score=score
obstacle = Block(bush,stone,cacti) obstacle = Block(bush,stone,cacti)
# rect = obstacle.get_rect() # rect = obstacle.get_rect()
...@@ -79,13 +81,13 @@ while True: ...@@ -79,13 +81,13 @@ while True:
else: else:
jumpState = "runing" jumpState = "runing"
t =30 t =30
bg_X-=1 bg_x-=1
if bg_x <= -1000: if bg_x <= -1000:
bg_x = 0# 悟空造型 bg_x = 0# 悟空造型
screen.blit(background, (bg_x, 0)) screen.blit(background, (bg_x, 0))
road_x-=8 road_x-=8
if roadx <= -1000: if road_x <= -1000:
roadx = 0 road_x = 0
screen.blit(road,(road_x,500)) screen.blit(road,(road_x,500))
screen.blit(wukong.image,(150,y)) screen.blit(wukong.image,(150,y))
time+=1 time+=1
......
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