主要还是用自定义的Move类。
1、在主场景中画一竖直的线,要粗点,作为身体。画一圆形作为头部,并转化为MC,实例名为ball
2、在电影的第一帧上加上
var p = Math.PI*2;
var a = [0, p / 4, 0, p / 4, 0, p / 4, 0, p / 4, p / 8];//人各个部位的弧度
var b = [400, 400, 450, 450, 450, 450, 300, 200, 175];
var c = [20, 20, 20, 20, 40, 40, 60, 80, 20];//人各个部位的y坐标和截距
var num = 9;//部位的数目,如要更多,自己添加
var i = 0;
while (i < num) {
ball.duplicateMovieClip("ball" + i, i);
this["ball" + i].i = i;
i++;
}
ball8._xscale = (ball8._yscale = 200);//头部放大
//下面为连线,组成一个人
onEnterFrame = function () {
createEmptyMovieClip("line", 2000);
with (line) {
lineStyle(8, 0, 100);
var i = 0;
while (i <= 1) {
moveTo(ball._x, ball._y);
lineTo(this["ball" + i]._x, this["ball" + i]._y);
i++;
}
var i = 0;
while (i <= 3) {
moveTo(this["ball" + i]._x, this["ball" + i]._y);
lineTo(this["ball" + (i + 2)]._x, this["ball" + (i + 2)]._y);
i++;
}
var i = 6;
while (i <= 7) {
moveTo(body._x, body._y);
lineTo(this["ball" + i]._x, this["ball" + i]._y);
i++;
}
}
};
3、选中头部,加上AS:
onClipEvent (load) {
var myMove = new Move (150, 300, 20, 2, 0);
var i;
if (this._name != "ball") {
myMove.timer(_parent.a[i]);//设置人各部位的弧度
myMove.cen_y(_parent.b[i]);//设置人各部位的截距
myMove.cen_a(_parent.c[i]);//设置人各部位的y坐标
} else {
myMove.cen_a(0);
myMove.cen_b(0);
}
if (this._name != "ball8") {
this._visible = 0;
}
}
onClipEvent (enterFrame) {
myMove.myMove(this);//小人转动
}