scratch 爬坡赛车教程,scratch编程教程赛车

首页 > 游戏 > 作者:YD1662023-06-15 22:01:19

3.向controls添加动作。这是使用箭头键转动赛车手的方法:

1)单击Motion。

2)拖动“turn [right arrow] 15 degrees”事件以使其位于“right arrow"”控件下方。

3)拖动“turn [left arrow] 15 degrees”事件以使其位于“left arrow”控件下方。

scratch 爬坡赛车教程,scratch编程教程赛车(25)

4.创建一个越界规则。使用此规则将确保,如果您的赛车手碰到背景颜色(不是赛道),它将撞毁:

1)单击Control,然后将“if then”选项拖到空白处。

2)单击“Sensing”,然后将“touching color”选项拖到“if then”选项的空白处(“if”和“then”之间)。

3)点击“touching color”旁边的当前颜色,然后单击一次你的赛车赛道的背景。

4)单击Looks,然后将“switch costume to”拖动到适合“if then”的间隔。

5)拖动整个“if then”程序集,使其适合“move 2 steps”规则下的“forever”间隙。

6)单击“Control”,然后将“stop all”选项拖动到“switch costume to”的下方即可。

7)单击“all”,然后在出现的下拉菜单中单击此脚本。

scratch 爬坡赛车教程,scratch编程教程赛车(26)

5.进行终点线反应。赛车手越过终点线,以下脚本将创建一条胜利消息:

1)单击Control,然后将“if then”选项拖到空白处。

2)单击“Sensing”,然后将“touching color”选项拖到“if then”选项的空白处(“if”和“then”之间)。

3)单击“touching color”旁边的当前颜色,然后单击一次终点线。

4)单击“Looks”,然后拖动“say hello for 2 secs”选项以适合“if then”间隔。

5)更改“hello”为“You won!”,然后将“2”更改为要使用的任意时间,然后按↵Enter。

6)将整个“if then”程序集拖到另一个“if”括号下面的“forever”括号中。

scratch 爬坡赛车教程,scratch编程教程赛车(27)

6.测试你的游戏。通过单击背景区域右下角的-图标缩小,单击左侧窗格上方的绿色标志,然后使用箭头键在轨道上移动。你应该能够顺利到达终点线。

scratch 爬坡赛车教程,scratch编程教程赛车(28)

上一页34567下一页

栏目热文

文档排行

本站推荐

Copyright © 2018 - 2021 www.yd166.com., All Rights Reserved.