【发布时间】:2023-03-11 20:11:01
【问题描述】:
我想知道如何使用 pygame 打印文本,目前我有这个代码(我认为它可以工作但没有用):
for player in player_list:
block_hit_list = pygame.sprite.spritecollide(player, block_list, True)
for block in block_hit_list:
health -= 25
collision.play()
if health == 0:
font = pygame.font.Font("freesansbold.ttf", 30)
label = font.render("GAME OVER", 1, (255,100,0))
screen.blit(label, (400, 300))
break
if health == 0:
gameover.play()
collision.stop()
player_list.remove(player)
all_sprites_list.remove(player)
block_list.remove(block)
all_sprites_list.remove(block)
我不知道为什么它不打印,如果有人有任何建议我很感激帮助!
【问题讨论】:
-
我们可以看看你的代码的其余部分/minimum working example吗?
-
@Michael0x2a 更新,道歉。