Closed DHUAVY closed 3 years ago
还是把项目包整体上传下,麻烦同学
现在可能变成210行了,如果是时事的话。。
可以设置一个计数器 show_level_up
,表示显示 Level Up 的循环次数,如果不为 0 就 blit 一次,并且减 1,直到减为 0。如果碰到新的升级,就重置为 SHOW_LEVEL_UP_LOOP_NUM
。
SHOW_LEVEL_UP_LOOP_NUM = 50
show_level_up = 0
# 游戏难度升级
def development():
global score, number_of_enemies, times, show_level_up, font_64, SHOW_LEVEL_UP_LOOP_NUM
if show_level_up > 0:
text = f'Level Up'
score_render = font_64.render(text, True, (255, 0, 0))
screen.blit(score_render, (270, 250))
show_level_up -= 1
if score >= 100 * times:
times += 1
show_level_up = SHOW_LEVEL_UP_LOOP_NUM
number_of_enemies += 2
enemies.append(Enemy())
enemies.append(Enemy())
for e in enemies:
e.step += 1
font_64 = pygame.font.Font('freesansbold.ttf', 64)
https://bhpan.buaa.edu.cn:443/link/3A50429FD35B318BFD605DE97FD265F2