dx;this._y += dy;if (this._x>=710){ this._x = -Math.floor(Math.random()*300);this._y = -Math.floor(Math.random()*300);} };} code = 174;char = chr(code);mytext_txt.text = char+" Huanbaiyiju";var isShow:Boolean=true;然后在第二帧加代码:isShow=false;...
求助各位大神,我用flash8.0做了一个流星雨效果,代码如下
把上面的代码替换成如下:
xrandom = new Array();
yrandom = new Array();
salerandom = new Array();
speed = Math.floor(Math.random()*10)+5;
for (_global.i=0; i<=19; i++)
{
xrandom[i] = Math.floor(Math.random()*700);
yrandom[i] = Math.floor(Math.random()*400);
salerandom[i] = Math.floor(Math.random()*20)+2;
duplicateMovieClip(ball, "ball"+i, i);
_root["ball"+i]._x = xrandom[i];
_root["ball"+i]._y = yrandom[i];
_root["ball"+i]._yscale = salerandom[i];
_root["ball"+i]._rotation = 20;
_root["ball"+i].onEnterFrame = function()
{
if(isShow==false)
{
this._visible=false;
this.onEnterFrame=null;
}
var a = this._rotation;
var rad = a*Math.PI/180;
var dx = Math.cos(rad)*speed;
var dy = Math.sin(rad)*speed;
this._x += dx;
this._y += dy;
if (this._x>=710)
{
this._x = -Math.floor(Math.random()*300);
this._y = -Math.floor(Math.random()*300);
}
};
}
code = 174;
char = chr(code);
mytext_txt.text = char+" Huanbaiyiju";
var isShow:Boolean=true;
然后在第二帧加代码:isShow=false;2012-07-17
我也不会诶,有点难....2012-07-17