跟随鼠标的曲线[flash游戏制作基础]


 Flash游戏制作基础,跟随鼠标的曲线,曲线和其它物体之间进行碰撞检测。网页教学网友情提示文章末尾提供Fla源文件的下载。
首先按Ctrl+J修改属性。

创建一个MC,如下图。是放大到800%的效果。

然后直接使用鼠标跟随,下面代码直接放到第一帧,创建轨迹。
tail_len = 2;
tail_nodes = 100;
nodes = new Array();
_root.attachMovie("the_head", "the_head", 1, {_x:250, _y:200});
_root.createEmptyMovieClip("the_tail", 2);
for (x=1; x
演示效果如下:
然后再建立一个MC设置如下,做一面墙来检测碰撞。

添加一个物体,来实验碰撞检测。添加如下Action到主场景第一帧:
tail_len = 2;
tail_nodes = 100;
nodes = new Array();
_root.attachMovie("the_head", "the_head", 1, {_x:250, _y:200});
_root.createEmptyMovieClip("the_tail", 2);
_root.attachMovie("wall", "wall", 3, {_x:250, _y:200});
for (x=1; x
本文转自:http://www.5uflash.com/flashjiaocheng/Flashyingyongkaifa/987.html

你可能感兴趣的:(html,游戏,Flash,J#,网页游戏)