paoCount = 0;//泡泡个数
rand = 0.9;//随机限度
createEmptyMovieClip("paos", 1);
this.onEnterFrame = function() {
if (Math.random()>rand) {
pao = paos.attachMovie("pao", "pao"+paoCount, paoCount++);
pao._x = this._x+385;//泡泡起始坐标
pao._y = this._y+120;
pao._xscale = pao._yscale=Math.random()*60+40;//随机大小
pao.onEnterFrame = paoMove;//泡泡运动
pao.vx = 12;
pao.vy = Math.random()*-5-1;
}
};
function paoMove() {//泡泡运动函数
this._y += this.vy;
this.vx += Math.random()*2-1;
this.vx *= rand;
this._x += this.vx;
if (this._y<0) {//出界了
this.removeMovieClip();
}
}
源文件:
paopao.rar
(55.64 KB, 下载次数: 109)
|