- 学一学28 分钟 · 场景、背景信号、有名字的消息、broadcast and wait
- 基础任务24 分钟 · 做出三个场景的故事
- 挑战 1–327 分钟 · 第四个场景、一段对话、每个场景一个声音
- 加分任务加分 · 先走进来,再说话
复习:巡线小车 5 分钟
前四节课,我们做了一个能感觉地面的机器人。
touching color [#000000]?问的是:角色的任何一部分有没有碰到这个颜色。color [#ff0000] is touching [#000000]?问的是角色身上的某一个颜色。两个传感器小点就是这样来转方向的。- 速度和转弯都是变量。你调整它们,让机器人走得更顺。
快问快答
机器人的左边有一个红点。线是黑色的。哪一块积木能告诉你,左边在线上?
看答案
color [#ff0000] is touching [#000000]?:红点碰到了黑色。如果机器人任何一部分碰到线,touching color [#000000]? 都会是“是”。
今天的主题 3 分钟
- 故事是一排场景
when backdrop switches to [Forest v]:背景就是一个信号- 消息的名字要说出它开始的是什么
broadcast [forest scene v] and wait,以及为什么等待很重要
学习目标
上完这节课,你能够:
- 把一个故事分成几个场景,每个场景用一条消息。
- 背景换了的时候,让每个角色站到自己的位置。
- 让每个场景演完,下一个场景才开始。
学一学:分场景的故事 28 分钟
先计划好故事
故事是一排场景。每个场景有一个地点和一个说话的人。
| 场景 | 背景 | 谁说话 | 说什么 |
|---|---|---|---|
| 1 | Forest | Wizard | This is Gobo. Gobo lives in the forest. / Today Gobo is going to the castle.(这是 Gobo。Gobo 住在森林里。/ 今天 Gobo 要去城堡。) |
| 2 | Castle 2 | Gobo | There it is! The castle! / I hope somebody is home.(就在那里!城堡!/ 希望有人在家。) |
| 3 | Castle 3 | Dragon | Hello, Gobo! Welcome to my castle. / Come in and play!(你好,Gobo!欢迎来到我的城堡。/ 进来玩吧!) |
从角色库里选三个角色:Wizard、Gobo 和 Dragon。三个背景:Forest、Castle 2 和 Castle 3。
背景就是一个信号
每个场景里,Gobo 站的位置都不一样。你可以在每个脚本里移动他。不过有一个更整齐的办法。
- 在角色列表里点 Gobo。
- 打开 Events(事件)。
- 拖出
when backdrop switches to [Forest v]。 - 在它下面加上
go to x: (10) y: (-60)。 - Castle 2 和 Castle 3 也这样做,用它们自己的数字。
when backdrop switches to [Forest v]
go to x: (10) y: (-60)
when backdrop switches to [Castle 2 v]
go to x: (60) y: (-120)
when backdrop switches to [Castle 3 v]
go to x: (-60) y: (-100)
Dragon 只应该出现在大厅里:
when backdrop switches to [Forest v]
hide
when backdrop switches to [Castle 3 v]
show
先不讲故事,只测试这些信号。这个舞台脚本每两秒换一次背景:
when flag clicked
forever
switch backdrop to [Forest v]
wait (2) seconds
switch backdrop to [Castle 2 v]
wait (2) seconds
switch backdrop to [Castle 3 v]
wait (2) seconds
end
怎么用: 点绿旗开始。不用再按别的。看 Gobo 在每个新背景跳到自己的位置,然后按 ■ Stop。
每个场景一条消息
每个场景都由一条消息开始。给它起一个名字,说出它开始的是什么:forest scene、castle scene、hall scene。像 message2 这样的名字,一个星期后你就看不懂了。
when I receive [forest scene v]
say [This is Gobo. Gobo lives in the forest.] for (2.5) seconds
say [Today Gobo is going to the castle.] for (2.5) seconds
when I receive [castle scene v]
say [There it is! The castle!] for (2) seconds
say [I hope somebody is home.] for (2) seconds
when I receive [hall scene v]
say [Hello, Gobo! Welcome to my castle.] for (2.5) seconds
say [Come in and play!] for (2) seconds
问题:大家一起说话
现在由 Wizard 来讲故事。先试一试这样做:
when flag clicked
switch backdrop to [Forest v]
broadcast [forest scene v]
switch backdrop to [Castle 2 v]
broadcast [castle scene v]
switch backdrop to [Castle 3 v]
broadcast [hall scene v]
say [The end!] for (2) seconds
broadcast [forest scene v] 发出消息后马上往下走。它不等这个场景。所以整个脚本一眨眼就跑完了。
怎么用: 点绿旗开始。不用再按别的,看它跑完,再用 ↺ Reset 重新运行。
修好它:broadcast and wait
Events(事件)里还有第二块广播积木。它会等。
| 积木 | 它做什么 | 什么时候用 |
|---|---|---|
broadcast [forest scene v] | 发出消息。马上往下走。 | 要让某件事开始,而且你不用等它。 |
broadcast [forest scene v] and wait | 发出消息。一直等到它开始的每个脚本都运行完。 | 这件事做完之前,下一件事不能开始。 |
when flag clicked
switch backdrop to [Forest v]
broadcast [forest scene v] and wait
switch backdrop to [Castle 2 v]
broadcast [castle scene v] and wait
switch backdrop to [Castle 3 v]
broadcast [hall scene v] and wait
say [The end!] for (2) seconds
怎么用: 点绿旗开始。不用再按别的。看完三个场景,再用 ↺ Reset 重新运行。
就像接力赛
普通的 broadcast 像起跑的枪声。大家在同一时刻一起跑。broadcast and wait 像接力赛。下一个跑的人要等接力棒。
基础任务:做出三个场景的故事 24 分钟
第 1 步:角色和地点
- 新建一个作品。删掉小猫。
- 从角色库里添加三个角色:Wizard、Gobo 和 Dragon。
- 添加三个背景:Forest、Castle 2 和 Castle 3。
- 把 Wizard 变小:大小设为 45。把他拖到最左边。
- 把 Dragon 的大小设为 60。把它的方向设为 −90,旋转方式设为左右翻转,这样它就面向 Gobo。
第 2 步:信号
给 Gobo 加上他的三组 when backdrop switches to [Forest v] 积木。给 Dragon 加上它的两组。用舞台上的 forever 脚本测试它们。然后删掉那个脚本。
第 3 步:三条消息
拖出任意一块 broadcast [forest scene v] 积木。打开它的下拉菜单,选 New message(新消息)。做出 forest scene、castle scene 和 hall scene。
第 4 步:台词
照着“学一学”,做出三组 when I receive [forest scene v] 积木。Wizard 身上一组,Gobo 身上一组,Dragon 身上一组。
第 5 步:讲故事脚本,错误的做法
在 Wizard 身上,用普通的 broadcast [forest scene v] 积木做讲故事脚本。点绿旗。看大家一起说话。先别修,看看哪里出错了。
第 6 步:讲故事脚本,正确的做法
把每个 broadcast 换成 broadcast [forest scene v] and wait。在每个下拉菜单里选同样的消息。再点一次绿旗。
对照一下你的 Wizard:
when flag clicked
switch backdrop to [Forest v]
broadcast [forest scene v] and wait
switch backdrop to [Castle 2 v]
broadcast [castle scene v] and wait
switch backdrop to [Castle 3 v]
broadcast [hall scene v] and wait
say [The end!] for (2) seconds
when I receive [forest scene v]
say [This is Gobo. Gobo lives in the forest.] for (2.5) seconds
say [Today Gobo is going to the castle.] for (2.5) seconds
Dragon 出现在森林里。
它少了 when backdrop switches to [Forest v],或者下面写的是 show,不是 hide。也要检查下拉菜单,它必须是 Forest。
故事在场景 1 之后就停了。
看看下拉菜单。Wizard 广播的是 castle scene,但 Gobo 可能在等另一个名字。castle scene 和 castle 是两条不同的消息。
有个场景一眨眼就跳过去了。
那一块 broadcast 还是普通的那种。and wait 那块积木比较长,最后一个词是 wait。
Gobo 一直待在同一个地方。
信号放错角色了。在角色列表里点 Gobo 看一看。它们必须在他的 Code 标签里。
第四个场景
- 大厅之后,Gobo 回家睡觉。
- 用 Bedroom 1 背景。
- Gobo 在那里说两句话。Dragon 不在卧室里。
- “The end!” 还是放在最后。
怎么用: 点绿旗开始。不用再按别的。看完四个场景,再用 ↺ Reset 重新运行。
Teacher reveal
Two more blocks for the Wizard, before “The end!”:
switch backdrop to [Bedroom 1 v]
broadcast [bedroom scene v] and wait
Plus a bedroom scene stack on Gobo, a Bedroom 1 cue for Gobo, and hide on the Dragon’s Bedroom 1 cue. Pupils who forget that last one see the Dragon tuck itself into bed.
一个场景里的对话
在大厅里,Dragon 和 Gobo 轮流说话:
| # | 谁 | 台词 |
|---|---|---|
| 1 | Dragon | Hello, Gobo! |
| 2 | Gobo | Hello, Dragon! |
| 3 | Dragon | Do you want to play?(你想玩吗?) |
| 4 | Gobo | Yes, please! |
不用 wait 积木。Gobo 说完 “Yes, please!” 之前,Wizard 不能说 “The end!”。
怎么用: 点绿旗开始。不用再按别的,看它跑完,再用 ↺ Reset 重新运行。
Teacher reveal — the chain has to wait too
when I receive [hall scene v]
say [Hello, Gobo!] for (2) seconds
broadcast [gobo hello v] and wait
say [Do you want to play?] for (2) seconds
broadcast [gobo yes v] and wait
On the Dragon. Gobo has two small stacks, one for each message. The trap: if the Dragon uses plain broadcast [gobo yes v] at the end, its script finishes before Gobo speaks. The Wizard only waits for scripts the hall scene message started — so “The end!” lands on top of “Yes, please!”.
每个场景一个声音
- 森林播放 Bird。Castle 2 播放 Medieval1。大厅播放 Medieval2。
- 新场景先停掉旧的声音,再播放自己的声音。
- “The end!” 之后,一切都安静下来。
怎么用: 打开声音。点绿旗开始。不用再按别的。每个场景开始时听一听。
Teacher reveal — put it on the Stage
when backdrop switches to [Forest v]
stop all sounds
start sound [Bird v]
when backdrop switches to [Castle 2 v]
stop all sounds
start sound [Medieval1 v]
when backdrop switches to [Castle 3 v]
stop all sounds
start sound [Medieval2 v]
Three cues on the Stage, which owns the sounds. The Wizard adds stop all sounds after “The end!”. A pupil who puts the music in the scene messages instead makes the storyteller wait for the song to end.
先走进来,再说话
- 每个场景开始时,Gobo 在左边的边上。
- 他走到中间。
- 他走到之前,谁都不说一句话。
怎么用: 点绿旗开始。不用再按别的。看 Gobo 走进来三次。
总结 3 分钟
- 故事是一排场景。先在表格里计划好。
when backdrop switches to [Forest v]是一个信号。用它让每个角色站到位置上。- 按照消息开始的事情来给它起名字。
broadcast [forest scene v]开始一个场景,然后马上往下走。broadcast [forest scene v] and wait会一直等到场景演完。这样就不会有人抢着说话了。
- 场景
- 故事的一部分:一个地点,一段说话。
- 信号(cue)
- 告诉角色现在该做什么的提示。
- broadcast and wait(广播并等待)
- 发出一条消息,然后等所有听到它的角色都做完。
- 讲故事脚本
- 按顺序控制整个故事的那一个脚本。
交作业
保存你的故事,发给老师。下一课,读故事的人可以选择 Gobo 去哪里。