Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. 知识库
  3. 二维积木
  4. 在舞台上打印文字

在舞台上打印文字

Scheduled Pinned Locked Moved 二维积木
1 Posts 1 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    creaticodeteacher2-mail
    wrote on last edited by admin
    #1

    介绍

    在麻省理工Scratch平台上,若要在舞台窗口显示文字,就必须把文字添加到造型中。而在创益编程游乐场,你可以用积木“打印文本”打印任意文本,非常简单。
     
     

    积木:“打印”

    你可以在外观类别中找到积木“打印”。

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/17749694-dc1c-4ef2-81ca-fc119b1ffd68.png" width="500" style="">
     

    参数

    • 打印的文本:你想在舞台窗口打印的文本。要注意,文字全都打印在一行。

    • 中心位置:文本中心的x坐标、y坐标。例如,如果x、y都为0,那么文本的中心就在播放器窗口中心。

    • 边界框尺寸:宽度、高度决定文本的大小。文本的宽度不能超过这个宽度,文本的高度不能超过这个高度。大多数情况下,这2个限制条件只有一个起作用。例如,如果你把宽度设置得很大,文本的最终尺寸将根据高度而定。

    • 颜色:你可以设置文本的颜色,甚至可以带透明度。

     
     

    范例

    在这个程序中,我们打印2行文本,大小不同,“你好!”为半透明:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/5b160b48-2fc2-457d-a0cb-297e456444cc.png" width="600" style="">

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/1bf6bd0d-f96a-49c5-bc48-dc9e40b798cf.png" width="500" style="border-radius: 5px; border: 1px solid #29622d;">

     
     

    打印一定的时间

    用另一个近似的“打印”积木,打印的文本显示一定时间,然后自动清除:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/e0c7b495-5247-4f25-bb8e-f49db7ae2190.png" width="600" style="">

    你只需要在最后一个输入框指定文本显示的秒数。

     
     

    清除文本

    每当你点击绿旗按钮,所有打印内容都被自动清除。然而,如果你想在程序运行中清除打印文本,可以用以下2个积木:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/66ed5297-da14-46a6-8e0d-9798157d31ed.png" width="150" style="">

    这个积木会清除本角色打印的全部文本。

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/63387a6c-683e-4efd-b114-2c55ac1908be.png" width="110" style="">

    这个积木会清除项目中所有角色打印的全部文本。

     
     

    范例

    该程序每秒打印一次计时器的值,同时也会清除之前的打印文本。

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/71195fa3-5bf7-4c33-bc40-86b28b797144.gif" width="900" style="border-radius: 5px; border: 1px solid #29622d;">

    1 Reply Last reply
    0

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode