
上QQ阅读APP看书,第一时间看更新
2.3 添加霸王龙
添加更多的恐龙角色,让我们恐龙乐园热闹起来。
⑨添加霸王龙角色
编辑器中提供了4种添加角色的方式。“添加角色”按钮在编辑器中的右下角。将鼠标移动至按钮上,按钮上即展开其他选择方式,单击按钮即可打开角色库。

⑩设定角色大小和名字
设置角色默认大小和位置。在角色素材区,选中角色,即可修改对应的角色大小、角色方向、角色名字和显示状态切换等。

⑪让霸王龙也动起来
将“三角龙”的代码,通过右键复制或者拖曳代码到“霸王龙”角色上完成代码复制。运行代码,霸王龙和三角龙都动起来了。


运行调试一下
单击“启动运行”,开始运行游戏项目。两只恐龙来回在舞台区中走来走去。当霸王龙遇上三角龙时,霸王龙会覆盖在三角龙的上面。

⑫造型的切换
游戏程序中也许只是一些角色不同,就可以将整个游戏趣味性提高一个等级。或者给角色创建更多造型,如行走、跳跃、受伤等。使用事件模块中的“空格事件”和外观模块中的“下一个造型”指令,可实现用空格键控制造型变换。


站立

跳跃

尖叫
外观造型的变换
按下空格键时,触发后续的脚本。
