Commit 621a444e by BellCodeEditor

save project

parent 7b377be8
Showing with 26 additions and 22 deletions
...@@ -27,12 +27,16 @@ hero = [pygame.image.load('hero1.png'), ...@@ -27,12 +27,16 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero3.png'), pygame.image.load('hero3.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')
basic_font = pygame.font.Font('STKAITI.TTF')
index = 0 index = 0
y = 400 y = 400
jumpState = "runing" jumpState = "runing"
t = 30 t = 30
gamestate = True
time = 0 time = 0
score = 0
old_score = score
#obstacle = Block([bush, stone, cacti]) #obstacle = Block([bush, stone, cacti])
block_list = pygame.sprite.Group() block_list = pygame.sprite.Group()
while True: while True:
...@@ -44,27 +48,27 @@ while True: ...@@ -44,27 +48,27 @@ 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 gamestate = True:
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": # 降落状态
if t <= 30: if t <= 30:
y += t y += t
t += 2 t += 2
else: else:
jumpState = "runing" jumpState = "runing"
t =30 t =30
# 悟空造型 # 悟空造型
wukong = hero[index] wukong = hero[index]
if jumpState == "runing": # 跑步状态下 if jumpState == "runing": # 跑步状态下
index += 1 index += 1
if index >= 5: if index >= 5:
index = 0 index = 0
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
# 远处背景 # 远处背景
......
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