Scratch过马路小游戏程制作教程
2018-09-29 本文已影响0人
我们都输给了现实
现在scratch编程被越来越多的孩子喜爱,作为家长的我们,应该如何让孩子学习scratch编程呢?看到别人家的孩子做出来的成品,贺卡,游戏乃至数学知识,是不是也很想自己的孩子也会scratch编程呢?下面我们来介绍一下如何用scratch制作一些小游戏:
Scratch编程制作过马路小游戏

这次我们为大家带来一款小游戏的制作教程,只要跟着步骤做,就能轻松地制作出属于自己的过马路小游戏。
家长们可以用此教程指导孩子逐步完成,然后一起测试和游玩,再一起探究每处代码的逻辑意义。
教程如下:
打开Scratch程序后,默认就会有一只小猫角色,我们就使用它当我们游戏的主角,然后再添加一个汽车角色。

而后编辑汽车的造型,点击右键菜单的复制命令,复制一个新的造型。


在新造型右上角,点击左右翻转按钮,使车子翻转到车头向左。
再分别修改两个造型的名称为A和B。

然后新建角色私有的变量,命名为速度。


编辑汽车的脚本代码。

这里主要就是实现随机位置、方向、颜色的机器,往返穿梭的景象。
现在运行的话,效果是这样的:

然后我们来编辑小猫角色。
首先新建角色私有变量,命名为死了。

然后编写脚本代码。

右键点击棕色的代码块,右键选择复制命令,复制并进行简单修改,以生成对应上移键的代码。

接着编写常规代码。

接着编写响应广播部分的代码。

至此就完成了整个程序,运行看看吧。
点击绿色旗子按钮运行后,按键盘上的下箭头、上箭头键移动小猫,被车碰到就失败,安全走到底部则获胜。
获胜情况:

失败情况:

恭喜你的孩子成功制作出了scratch的小游戏,上传把链接发发到朋友圈炫耀一下吧!