function addStar()
{
star = attachMovie(\"dot\", \"d\" + count, count++);
star.x = blue.oldx;
star.y = blue.oldy;
star.z = blue.oldz;
star.onEnterFrame = starMove;
} // End of the function
function starMove()
{
var _loc1 = this;
var _loc2 = red.x - _loc1.x;
var _loc3 = red.y - _loc1.y;
var _loc3 = red.z - _loc1.z;
var distSQ = _loc2 * _loc2 + _loc3 * _loc3 + _loc3 * _loc3;
var force = 15000 / distSQ;
var zangle = Math.atan2(_loc3, _loc2);
_loc1.vx = _loc1.vx + Math.cos(zangle) * force;
_loc1.vy = _loc1.vy + Math.sin(zangle) * force;
var yangle = Math.atan2(_loc3, _loc2);
_loc1.vz = _loc1.vz + Math.sin(yangle) * force;
_loc1.vy = _loc1.vy + grav; _loc1.x = _loc1.x + _loc1.vx;
_loc1.y = _loc1.y + _loc1.vy;
_loc1.z = _loc1.z + _loc1.vz;
if (_loc1.y > 200)
{
_loc1.y = 200;
_loc1.vy = _loc1.vy * -7.000000E-001;
} // end if
if (_loc1.z < -fl)
{
_loc1._visible = false;
} // end if
if (_loc1.age++ > 200)
{
_loc1.removeMovieClip();
return;
} // end if
var scale = fl / (fl + _loc1.z + cz);
_loc1._x = cx + _loc1.x * scale;
_loc1._y = cy + _loc1.y * scale;
_loc1._xscale = _loc1._yscale = scale * 100;
} // End of the function
stop ();
cx = 350;
cy = 200;
cz = 50;
fl = 300;
createEmptyMovieClip(\"lines\", 10000000);
createEmptyMovieClip(\"lines2\", 10000001);
lines.lineStyle(1, 16777215, 10);
for (xa = -10; xa < 11; xa++)
{
x = xa * 100;
y = 200;
scale = fl / (fl - 50 + cz);
x1 = x * scale + cx;
y1 = y * scale + cy;
lines.moveTo(x1, y1);
scale = fl / (fl + 2000 + cz);
x2 = x * scale + cx;
y2 = y * scale + cy;
lines.lineTo(x2, y2);
} // end of for
for (ya = 0; ya < 20; ya++)
{
y = 200;
z = ya * 100;
scale = fl / (fl + z + cz);
x1 = 1000 * scale + cx;
y1 = y * scale + cy;
lines.moveTo(x1, y1);
x2 = -1000 * scale + cx;
lines.lineTo(x2, y1);
} // end of for
grav = 1.200000E-001;
baseSpeed = -1.000000E-002;
red.y = -100;
blue.y = -100;
onEnterFrame = function ()
{
baseSpeed = (_xmouse - 350) * 2.000000E-004;
baseAngle = baseAngle + baseSpeed;
red.x = Math.cos(baseAngle) * 200;
red.z = Math.sin(baseAngle) * 200 + 200;
blue.x = -red.x;
blue.z = -(red.z - 200) + 200;
var _loc1 = fl / (fl + red.z + cz);
red._x = cx + red.x * _loc1;
red._y = cy + red.y * _loc1;
red._xscale = red._yscale = _loc1 * 100;
red.swapDepths(1000000000 - red.z * 100);
lines2.clear();
lines2.lineStyle(1, 255, 30);
lines2.moveTo(red._x, red._y);
lines2.lineTo(red._x, 200 * _loc1 + cy);
_loc1 = fl / (fl + blue.z + cz);
blue.oldx = blue.x;
blue.oldy = blue.y;
blue.oldz = blue.z;
blue._x = cx + blue.x * _loc1;
blue._y = cy + blue.y * _loc1;
blue._xscale = blue._yscale = _loc1 * 100;
blue.swapDepths(1000000000 - blue.z * 100);
lines2.lineStyle(1, 16711680, 30);
lines2.moveTo(blue._x, blue._y); l
ines2.lineTo(blue._x, 200 * _loc1 + cy);
if (getTimer() - start > 300)
{
addStar();
start = getTimer();
} // end if
};
[ 本帖最后由 云端漫步 于 2010-2-6 16:16 编辑 ] |