Commit 85db871f by BellCodeEditor

save project

parent 436db26f
Showing with 26 additions and 23 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,28 +48,27 @@ while True: ...@@ -44,28 +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"
wukong = hero[index] if gamestate == True:
if jumpState == "runing": # 跑步状态下 if jumpState == "up": # 起跳状态
index += 1 if t > 0:
if index >= 5: y -= t
index = 0 t -= 2
if g else:
if jumpState == "up": # 起跳状态 jumpState = "down"
if t > 0: if jumpState == "down": # 降落状态
y -= t if t <= 30:
t -= 2 y += t
else: t += 2
jumpState = "down" else:
if jumpState == "down": # 降落状态 jumpState = "runing"
if t <= 30: t =30
y += t
t += 2 # 悟空造型
else: wukong = hero[index]
jumpState = "runing" if jumpState == "runing": # 跑步状态下
t =30 index += 1
if index >= 5:
# 悟空造型 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