游戏制作语言新线
我正在编写一个 GML 脚本,想知道如何使消息出现在下一行:
例如。
show_message("Hello" + *something* + "World")
输出:
Hello
World
I am writing a GML script and wanted to know how to make a message appear on the next line:
ex.
show_message("Hello" + *something* + "World")
outputs:
Hello
World
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
对于 GameMaker: Studio 2,请始终使用
\n
作为新行。对于早期版本,请始终使用
#
作为新行。For GameMaker: Studio 2, always use
\n
as new line.For earlier releases, always use
#
as new line.我不太肯定(以前从未使用过 Game Maker),但手册似乎指出 # 可以工作(尽管这可能只适用于 draw_string)。您还可以尝试 Chr(13) + Chr(10),它们是回车符和换行符。
因此,您可以尝试:
或
来自:http://gamemaker.info/en/manual/gmaker
I'm not positive (never used Game Maker before) but the manual appears to state that a # will work (though that may only work for draw_string). You can also try Chr(13) + Chr(10), which are a carriage return and linefeed.
So, you could try:
or
From: http://gamemaker.info/en/manual/gmaker
尽管其他提到的方法更“正确”,但在 Game Maker 中,您也可以直接在代码编辑器中编写新行:
但是这样代码会有点混乱。
Despite the other mentioned methods are more "correct", in Game Maker you can also write the new line straight in the code editor:
But codes get a bit messy this way.
要创建新行,请使用 # 因此,例如
要打印此内容:
使用此:
To create a new line use # So for example
To print this:
Use this:
Game Maker 1.4 可以使用井号作为换行符以及换行符 (
chr(10)
):从 GameMakerStudio 2 开始,您现在可以使用转义字符;
Game Maker 1.4 can use the pound sign for newlines, as well as the linefeed character (
chr(10)
):Since GameMakerStudio 2 you can now use escaped characters;
使用
#
开始一个新行:会像这样:
但是,
会像这样:
Use
#
to start a new line:Would come out like this:
However,
Would come out like this:
正如其他人所说,您可以使用
"string#this is in a new line"
如果您想使用主题标签作为文本而不是换行符,请使用
\#
您可以在此处查找有关字符串的更多信息。
As others have stated you can use
"string#this is in a new line"
If you want to use a hashtag as text and not newline use
\#
You can look up more information about strings here.
这是另一个例子。您可以使用函数
draw_text(x,y,string)
代替出现消息框。示例如下:
draw_text(320,320,"Hello World");< /code>
希望这有帮助
Here's another example. Instead of having a message box come up, you could use the function
draw_text(x,y,string)
An example of this would be:
draw_text(320,320,"Hello World");
Hope this helps