1 / 1
文档名称:

Flash游戏制作基础:跟随鼠标的曲线.txt

格式:txt   页数:1页
下载后只包含 1 个 TXT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

Flash游戏制作基础:跟随鼠标的曲线.txt

上传人:baixue 2013/5/31 文件大小:0 KB

下载得到文件列表

Flash游戏制作基础:跟随鼠标的曲线.txt

文档介绍

文档介绍:本文由hanlongppl贡献
Flash 游戏制作基础:跟随鼠标的曲线游戏制作基础:
作者: 类型:转载来源: 作者:闪电儿类型转载来源网页教学网
Flash 游戏制作基础,跟随鼠标的曲线,曲线和其它物体之间进行碰撞检测。网页教学网友情提示文章末尾提供 Fla 源文件的下载。
首先按 Ctrl+J 修改属性。
创建一个 MC,如下图。是放大到 800%的效果。
然后直接使用鼠标跟随,下面代码直接放到第一帧,创建轨迹。
tail_len = 2; tail_nodes = 100; nodes = new Array(); ("the_head", "the_head", 1, {_x:250, _y:200}); ("the_tail", 2); for (x=1; x<tail_nodes; x++) { nodes[x] = {x:, y:}; } = function() { = ; = ; (); (2, 0x00ff00);
(, ); nodes[0] = {x:, y:}; for (var x = 1; x<tail_nodes-1; ++x) { rotation = (nodes[x].y-nodes[x-1].y, nodes[x].x-nodes[x-1].x); pos_x = nodes[x-1].x+tail_len*(rotation); pos_y = nodes[x-1].y+tail_len*(rotation); nodes[x] = {x:pos_x, y:pos_y}; (pos_x, pos_y); } };
演示效果如下:(图一)
然后再建立一个 MC 设置如下,做一面墙来检测碰撞。
添加一个物体,来实验碰撞检测。添加如下 Action 到主场景第一帧:
tail_len = 2; tail_nodes = 100; nodes = new Array(); ("the_head", "the_head", 1, {_x:250, _y:200}); ("the_tail", 2); ("wall", "wall", 3, {_x:250, _y:200}); for (x=1; x<tail_nodes; x++) { nodes[x] = {x:, y:}; } =