【问题标题】:Game Maker Language new line游戏制作语言新行
【发布时间】:2010-12-12 21:41:13
【问题描述】:

我正在编写一个 GML 脚本,想知道如何让消息出现在下一行:

例如。

show_message("Hello" + *something* + "World")

输出:

Hello
World

【问题讨论】:

  • 你应该在 Game Maker 论坛上问这个问题。
  • @Artelius 那么为什么存在 StackOverflow? :)
  • @RobQuist SO 在 09 年有点不同:P
  • @Artelius 神圣的废话我在挖坟:O 抱歉,正在尝试清理 GML / GM 标签/问题和答案,哈哈。

标签: game-maker gml game-maker-language game-maker-studio-2 game-maker-studio-1.4


【解决方案1】:

对于 GameMaker: Studio 2,请始终使用 \n 作为换行符。

show_debug_message("First Line\nSecond Line");

对于早期版本,请始终使用# 作为换行符。

show_message("First Line#Second Line");

【讨论】:

    【解决方案2】:

    我不肯定(以前从未使用过 Game Maker),但手册似乎声明 # 会起作用(尽管这可能仅适用于 draw_string)。也可以试试 Chr(13) + Chr(10),即回车换行。

    所以,你可以试试:

    show_message("Hello#World") 
    

    show_message("Hello" + chr(13) + chr(10) +"World") 
    

    发件人:http://gamemaker.info/en/manual/gmaker

    【讨论】:

      【解决方案3】:

      尽管提到的其他方法更“正确”,但在 Game Maker 中您也可以直接在代码编辑器中编写新行:

      show_message("Hello
      World");
      

      但是这样代码会有点乱。

      【讨论】:

        【解决方案4】:

        要创建一个新行,请使用 # So 例如

        要打印这个:

        Hello
        World
        

        使用这个:

        show_message('Hello#World');
        

        【讨论】:

          【解决方案5】:

          Game Maker 1.4 可以使用井号作为换行符,以及换行符 (chr(10)):

          show_debug_message("Hello#World");
          show_debug_message("Hello" + chr(10) + "World");
          

          从 GameMakerStudio 2 开始,您现在可以使用转义字符;

          show_debug_message("Hello\nWorld");
          show_debug_message("Hello#World"); //Will not work, the pound sign is now literal!
          show_debug_message("Hello" + chr(10) + "World");
          

          【讨论】:

            【解决方案6】:

            使用# 开始新的一行:

            show_message("Hello World!")  
            

            会像这样出来:

            Hello World!
            

            然而,

            show_message("Hello#World!")  
            

            会像这样出来:

            Hello
            World!
            

            【讨论】:

              【解决方案7】:

              正如其他人所说,您可以使用"string#this is in a new line" 如果您想将主题标签用作文本而不是换行符,请使用 \#

              You can look up more information about strings here.

              【讨论】:

                【解决方案8】:

                这是另一个例子。您可以使用函数draw_text(x,y,string)

                ,而不是出现消息框

                这方面的一个例子是:draw_text(320,320,"Hello World");

                希望对你有帮助

                【讨论】:

                • 不是用户要求的。
                猜你喜欢
                • 1970-01-01
                • 2020-12-07
                • 1970-01-01
                • 1970-01-01
                • 2014-11-25
                • 2021-04-21
                • 1970-01-01
                • 2010-09-10
                • 1970-01-01
                相关资源
                最近更新 更多