PDA

View Full Version : Shooting Stars


Ben H
01-19-2006, 02:39 PM
A'ight, here's another entry for y'all...
I managed to get it down to 15 lines of code by storing the return values of functions in arrays (objs[0].va, objs[i].va, objs[n].vb).


Stage.scaleMode = "noScale";
objs = [createEmptyMovieClip(0,getNextHighestDepth())];
objs[0].va = [objs[0].lineStyle(0, 0, 0), objs[0].beginFill(0xEEDD00, 100), objs[0].moveTo(0, 0)];
for (a=0, r=15; a<=Math.PI*2; a+=Math.PI*0.2, r = 12+(12-r)) {
objs[0].lineTo(Math.cos(a)*r, Math.sin(a)*r);
}
(Mouse.hide()) ? i=1 : null;
onEnterFrame = function() {
objs[i] = objs[0].duplicateMovieClip(i,getNextHighestDepth());
objs[i].va = [_root.objs[0]._x = _root._xmouse, _root.objs[0]._y = _root._ymouse, objs[i].xspeed = random(20)+1-10, objs[i].yspeed = random(20)+1-10];
for (n=1; n<(i+1); n++) {
objs[n].vb = [objs[n]._alpha -= 5, objs[n]._height -= 1, objs[n]._width -= 1, objs[n]._x += objs[n].xspeed, objs[n]._y += objs[n].yspeed];
(objs[n]._alpha < -5) ? objs[n].removeMovieClip() : null;
}
i++;
objs[0]._rotation += 5;
}


-Ben

Ben H
01-19-2006, 02:52 PM
Meh, just noticed that there's another entry exactly the same (http://www.kirupa.com/forum/showthread.php?t=205395) - But I have less lines, so :P

-Ben

NiñoScript
01-19-2006, 02:53 PM
pretty :)

reminds me of icio's rotating stars :P

Ben H
01-19-2006, 03:00 PM
in what way?

-Ben

Seb Hughes
01-19-2006, 03:55 PM
Thats kinda cool :D

NiñoScript
01-19-2006, 06:42 PM
in what way?
its the same background color, and with yellow-ish stars on top :P

Pasquale
01-19-2006, 07:49 PM
:) tis nice!

kdd
01-19-2006, 08:28 PM
well... it crashed ie...:P

Ben H
01-20-2006, 02:04 AM
well... it crashed ie...:P
just tried it in ie, doesnt crash for me, and it deletes the stars when their _alpha drops too low.

http://sfx-images.mozilla.org/affiliates/Buttons/110x32/get.gif (http://www.spreadfirefox.com/?q=affiliates&id=60490&t=64)

-Ben

kdd
01-20-2006, 02:22 AM
well, it wasn't ie's problem... the computer i was using at the university couldn't handle that... :)