<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[广播消息与接收消息]]></title><description><![CDATA[<p dir="auto"> </p>
<h2><a class="anchor-offset" name="先修科目"></a>先修科目</h2>
<ul>
<li><a href="/topic/461/%E7%BB%84%E8%A3%85%E7%A7%AF%E6%9C%A8">组装积木</a></li>
</ul>
<p dir="auto"> </p>
<h2><a class="anchor-offset" name="什么是消息"></a>什么是消息？</h2>
<p dir="auto">消息就是一个人发给另一个人的一些信息。</p>
<p dir="auto">例如，老师说“坐下”，然后学生听到了。这里的“坐下”就是一条消息。</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/faf444db-42b7-4a22-9a35-0dc9cadedfc9.png" width="500" /><br />
 </p>
<h3><a class="anchor-offset" name="广播消息"></a>广播消息</h3>
<p dir="auto">当<strong>同一条消息同时被发送至多个人</strong>，我们就称之为广播消息。</p>
<p dir="auto">例如，老师说“坐下”，教室里的所有学生都听到了。</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/2fbb1a6f-3743-49b2-a4ec-4d0d1e940e76.png" width="500" /><br />
 </p>
<h3><a class="anchor-offset" name="带参数的消息"></a>带参数的消息</h3>
<p dir="auto">有时，我们需要为消息附加一些额外信息。例如，假设老师想让学生先跳3下再跳5下。老师就可以用消息“蹦跳”，然后指定次数（3或5）。</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/9d6943c3-f6d0-4950-821a-cc5b0405ea5b.png" width="500" /><br />
 </p>
<h2><a class="anchor-offset" name="与消息相关的积木"></a>与消息相关的积木</h2>
<p dir="auto">与消息相关的积木都在“事件”类别，不是“帽子积木”就是“堆栈积木”。</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/4c403373-03eb-4411-a1b5-1527bf28605f.png" width="700" /><br />
 </p>
<h3><a class="anchor-offset" name="积木-广播-消息-与-当收到-消息"></a>积木：“广播（消息）”与“当收到（消息）”</h3>
<p dir="auto">积木“广播（消息）”用来向项目中的所有角色同时发送消息。当角色收到消息后，积木“当收到（消息）”就会运行它下面的积木。如果角色没有针对某个消息的积木“当收到( )”，那这个角色就会忽略这条消息。注意，角色可以收到自身广播的消息。</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/b58956d6-abfa-4ead-9b7e-c9e3f35f0e54.gif" width="900" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> </p>
<h3><a class="anchor-offset" name="积木-发送-消息-给角色"></a>积木：”发送（消息）给角色（ ）“</h3>
<p dir="auto">如果你只想把消息发送给一个角色，而不是所有角色，就可以用积木”发送（消息）给角色（ ）“，而不用积木“广播（消息）”。</p>
<p dir="auto">你可以从下拉列表中选择一个接收消息的角色，那么这条消息只会发送至该角色。</p>
<p dir="auto">例如，在这个项目中，棒球和篮球这两个角色都会响应消息“旋转”。当点击按钮，消息“旋转”被发送至2个角色其中之一。</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/317b759b-23cb-4dc7-b68e-aee3530f7c74.gif" width="900" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> </p>
<h3><a class="anchor-offset" name="积木-广播-消息-并等待"></a>积木：“广播（消息）并等待”</h3>
<p dir="auto">这个积木向所有角色广播消息，然后<strong>等待所有角色处理完消息</strong>。例如，在这个程序中，我们响应“消息1”时就说2秒“你好！”。因此，积木“广播( )并等待”在此期间等待，只有当积木“说”完成后，才能运行积木“下一个造型”。</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/8d5a29c2-5d52-4c45-92f8-58f62702f90a.gif" width="900" style="border-radius:5px;border:1px solid #29622d" /></p>
<p dir="auto"> </p>
<h3><a class="anchor-offset" name="积木-广播-消息-带参数-quot"></a>积木：“广播（消息）带参数( )"</h3>
<p dir="auto">这个积木可以让我们广播消息并指定一个参数随消息发出。</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/0e0d42f1-4779-450b-ab71-8004d7e33b14.gif" width="900" style="border-radius:5px;border:1px solid #29622d" /><br />
 </p>
<h3><a class="anchor-offset" name="积木-当收到-消息-参数"></a>积木：”当收到（消息）参数( )“</h3>
<p dir="auto">这个积木用来处理带参数的消息。若要使用该积木，需要在下拉列表中指定一个变量，从而当收到消息时参数的值会赋给这个变量。</p>
<p dir="auto">例如，如果我们设定变量为”<strong>20</strong>“，那么，当运行积木”当收到（消息）参数( )“，变量”i“就会被赋值20.</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/dba0c941-50cf-4375-81a6-1e28f3beb4f0.gif" width="900" style="border-radius:5px;border:1px solid #29622d" /><br />
 </p>
<h3><a class="anchor-offset" name="积木-广播-消息-带参数-并等待-quot"></a>积木：“广播（消息）带参数( )并等待"</h3>
<p dir="auto">这个积木类似于“广播（消息）带参数( )"，就除了还要等待所有角色处理完消息或者忽略消息，然后才运行下一个积木。</p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/6c6473c3-c4bd-4f42-834d-62c085c3a1f5.gif" width="900" style="border-radius:5px;border:1px solid #29622d" /><br />
 </p>
<h2><a class="anchor-offset" name="新建消息"></a>新建消息</h2>
<p dir="auto">新建消息方法：<strong>点击下拉菜单</strong>并选择“<strong>新消息</strong>”。<img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/1259aeea-4fb2-44b9-a89d-a1fa9df6e2b6.png" width="180" /><br />
会弹出一个窗口让你设置新消息的名称。<img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/b405a623-3393-40ba-928b-1163ca3df65b.png" width="250" /></p>
<p dir="auto"> </p>
<p dir="auto"><img src="https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/3d0abcf6-cb09-49de-a885-549fcacbb524.gif" width="900" style="border-radius:5px;border:1px solid #29622d" /><br />
 </p>
]]></description><link>https://forum.creaticode.com/topic/535/广播消息与接收消息</link><generator>RSS for Node</generator><lastBuildDate>Tue, 09 Jun 2026 06:23:40 GMT</lastBuildDate><atom:link href="https://forum.creaticode.com/topic/535.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 30 Aug 2022 04:18:17 GMT</pubDate><ttl>60</ttl></channel></rss>