我想做一个游戏,我想呈现很多文字。当文本呈现时,其余文本将离开屏幕。有什么简单的方法可以让文本转到pygame窗口的下一行吗?
helpT = sys_font.render \
("This game is a combination of all of the trends\n of 2016. When you press 'Start Game,' a menu will pop up. In order to beat the game, you must get a perfect score on every single one of these games.",0,(hecolor))
screen.blit(helpT,(0, 0))
正如我在评论中所说;你必须分别呈现每个单词,并计算文本的宽度是否延伸了表面(或屏幕)的宽度。下面是一个例子:
结果
我就是这样做的
但当然,我只能这样做,因为我的文本从屏幕顶部开始一行距离。如果你从屏幕的下面开始你可以
在pygame中,在多行上呈现文本并不容易,但是这个helper函数可以为您提供一些用途。只需输入文本(带换行符)、x、y和字体大小。
相关问题 更多 >
编程相关推荐