PDA

View Full Version : mouse seeking sharks



McGiver
January 16th, 2006, 05:21 PM
they circle slowly around your mouse - sharks have time, and your cursor smells very appetising.
Hold down the left mouse button and your cursor will dissappear ... the sharks get confused and will look where it's gone.


Formarray = [0, 0, 3.5, 3, 1.5, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 6, 7, 11, 8.5, 9, 8, 6, 3];
onMouseDown = function () {
mod = 270;
Mouse.hide()
};
onMouseUp = function () {
mod = 0;
Mouse.show()
};
onEnterFrame = function () {
for (fn=1; fn<=3; fn++) {
npangle = (Math.atan((((_root["mpointarr"+fn] == undefined) ? _root["mpointarr"+fn]=[0, 0, 0, 0] : _root["mpointarr"+fn])[i+1]-_ymouse)/(_xmouse-_root["mpointarr"+fn][i]))/(Math.PI/180)+(((_xmouse-_root["mpointarr"+fn][i])>=0) ? ((_xmouse-_root["mpointarr"+fn][i])>=0 && (_root["mpointarr"+fn][i+1]-_ymouse)>=0) ? 540 : 180 : 0))+360+mod*Math.cos(Math.PI*fn);
(Math.sqrt(Math.pow(_xmouse-_root["mpointarr"+fn][i], 2)+Math.pow(_root["mpointarr"+fn][i+1]-_ymouse, 2))>40 && !_root["task"+fn]>0) ? 1 : ((_root["task"+fn]>0) ? _root["task"+fn]-- : _root["task"+fn]=60);
(Math.sqrt(Math.pow(_xmouse-_root["mpointarr"+fn][i], 2)+Math.pow(_root["mpointarr"+fn][i+1]-_ymouse, 2))>40 && !_root["task"+fn]>0) ? _root["mpointarr"+fn].push(Math.cos(Math.PI*fn)*Math.sin((npangle-15*Math.cos(Math.PI*fn)+3*fn)*Math.PI/180)*(4-fn/20)+_root["mpointarr"+fn][i+2]) : _root["mpointarr"+fn].push(Math.cos((npangle+15*Math.cos(Math.PI*fn)+3* fn)*Math.PI/180)*(4-fn/20)+_root["mpointarr"+fn][i+2]);
(Math.sqrt(Math.pow(_xmouse-_root["mpointarr"+fn][i], 2)+Math.pow(_root["mpointarr"+fn][i+1]-_ymouse, 2))>40 && !_root["task"+fn]>0) ? _root["mpointarr"+fn].push(Math.cos(Math.PI*fn)*Math.cos((npangle-15*Math.cos(Math.PI*fn)+3*fn)*Math.PI/180)*(4-fn/20)+_root["mpointarr"+fn][i+3]) : _root["mpointarr"+fn].push(Math.sin((npangle+15*Math.cos(Math.PI*fn)+3* fn)*Math.PI/180)*(4-fn/20)+_root["mpointarr"+fn][i+3]);
(_root["mpointarr"+fn].length>40) ? _root["mpointarr"+fn].splice(0, _root["mpointarr"+fn].length-40) : 1;
for (createEmptyMovieClip("fish"+fn, 70+fn+(i=0)); i<_root["mpointarr"+fn].length-4; i += 2) {
angle2 = (Math.atan((_root["mpointarr"+fn][i+3]-_root["mpointarr"+fn][i+1])/(_root["mpointarr"+fn][i]-_root["mpointarr"+fn][i+2]))/(Math.PI/180)+(((_root["mpointarr"+fn][i]-_root["mpointarr"+fn][i+2])>=0) ? ((_root["mpointarr"+fn][i]-_root["mpointarr"+fn][i+2])>=0 && (_root["mpointarr"+fn][i+3]-_root["mpointarr"+fn][i+1])>=0) ? 540 : 180 : 0));
angle22 = (Math.atan((_root["mpointarr"+fn][i+5]-_root["mpointarr"+fn][i+3])/(_root["mpointarr"+fn][i+2]-_root["mpointarr"+fn][i+4]))/(Math.PI/180)+(((_root["mpointarr"+fn][i+2]-_root["mpointarr"+fn][i+4])>=0) ? ((_root["mpointarr"+fn][i+2]-_root["mpointarr"+fn][i+4])>=0 && (_root["mpointarr"+fn][i+5]-_root["mpointarr"+fn][i+3])>=0) ? 540 : 180 : 0));
_root["fish"+fn].beginFill(0x000000, 100);
_root["fish"+fn].moveTo(Math.sin(angle2*Math.PI/180)*Formarray[i/2+2]+_root["mpointarr"+fn][i+2], Math.cos(angle2*Math.PI/180)*Formarray[i/2+2]+_root["mpointarr"+fn][i+3]);
_root["fish"+fn].lineTo(Math.sin(angle22*Math.PI/180)*Formarray[i/2+3]+_root["mpointarr"+fn][i+4], Math.cos(angle22*Math.PI/180)*Formarray[i/2+3]+_root["mpointarr"+fn][i+5]);
_root["fish"+fn].curveTo(_root["mpointarr"+fn][i+2], _root["mpointarr"+fn][i+3], Math.sin((angle22+180)*Math.PI/180)*Formarray[i/2+3]+_root["mpointarr"+fn][i+4], Math.cos((angle22+180)*Math.PI/180)*Formarray[i/2+3]+_root["mpointarr"+fn][i+5]);
_root["fish"+fn].lineTo(Math.sin((angle2+180)*Math.PI/180)*Formarray[i/2+2]+_root["mpointarr"+fn][i+2], Math.cos((angle2+180)*Math.PI/180)*Formarray[i/2+2]+_root["mpointarr"+fn][i+3]);
_root["fish"+fn].curveTo(_root["mpointarr"+fn][i], _root["mpointarr"+fn][i+1], Math.sin(angle2*Math.PI/180)*Formarray[i/2+2]+_root["mpointarr"+fn][i+2], Math.cos(angle2*Math.PI/180)*Formarray[i/2+2]+_root["mpointarr"+fn][i+3]);
}
_root["fish"+fn].lineStyle(1, 0xffffff, 50);
(_root["mpointarr"+fn].length>26) ? _root["fish"+fn].moveTo(_root["mpointarr"+fn][20], _root["mpointarr"+fn][21]) : 1;
(_root["mpointarr"+fn].length>26) ? _root["fish"+fn].curveTo(_root["mpointarr"+fn][22], _root["mpointarr"+fn][23],_root["mpointarr"+fn][24], _root["mpointarr"+fn][25]) : 1;
(_root["mpointarr"+fn].length>12) ? _root["fish"+fn].moveTo(_root["mpointarr"+fn][8], _root["mpointarr"+fn][9]) : 1;
(_root["mpointarr"+fn].length>12) ? _root["fish"+fn].lineTo(_root["mpointarr"+fn][10], _root["mpointarr"+fn][11]) : 1;
}
};


again something I did before - far less complex than the BF compiler, but probably worth wasting a little time ;)

see also
->flower chain (http://www.kirupa.com/forum/showthread.php?t=205347)
->Bf compiler/interpreter (http://www.kirupa.com/forum/showthread.php?t=205641)

Sammo
January 16th, 2006, 05:30 PM
That's incredibly cool for 25 lines, but why the disappearing every now and again?

Jeff Wheeler
January 16th, 2006, 05:30 PM
I think this contest is popularizing miniaturized code. Nobody can read that. :P

Very nice :thumb:

McGiver
January 16th, 2006, 05:54 PM
That's incredibly cool for 25 lines, but why the disappearing every now and again?
If you're talking about sharks swimming away if they're close to the cursor:
I thought that would make it less monotonous.

Seb Hughes
January 16th, 2006, 05:55 PM
The pwns.

Sammo
January 16th, 2006, 06:07 PM
I think this contest is popularizing miniaturized code. Nobody can read that. :P

Very nice :thumb:
This contest reminds me of a saying that acompanied C: "Write only" instead of windows' "Read-only"

kirupa
January 16th, 2006, 06:13 PM
Very very nice :P

ElectricGrandpa
January 16th, 2006, 06:25 PM
That's quite cool :D

kdd
January 16th, 2006, 06:56 PM
that's really cool... though, it's a little hard to see it in a blue bg...

Sinister Shadow
January 16th, 2006, 07:10 PM
Oh wow! All of these entries and I can't even come up with an idea!

squan
January 16th, 2006, 07:17 PM
Darn man, how do you guys get the math together for stuff like that? That's just amazing.

Jeff Wheeler
January 16th, 2006, 09:47 PM
Sometimes they overlap awkwardly. Or maybe that's just me.

NiñoScript
January 16th, 2006, 11:19 PM
awsome :)

i like to move the mouse in circle around them so they feel intimidated and stay in a little place :lol:

hybrid101
January 17th, 2006, 07:54 AM
so cool man!!! that is wicked sick! i love it!:crazy:

Deril
January 17th, 2006, 11:41 AM
nice code! took some time to read it..
good work.

kenshin
February 7th, 2006, 01:46 PM
stunning. Great job

ritual
February 19th, 2006, 09:50 AM
I cant find the sharks

McGiver
February 19th, 2006, 10:30 AM
press the left mouse button to make the sharks swim towards your cursor

if that doesn't work maybe you have an old version of flash player.

or maybe you use gmail. Sharks smell if a cursor was used to navigate through gmail. Google's servers are made out of dead sharks.

ritual
February 19th, 2006, 11:24 AM
it still isn't working, i'm using flash8, i'm also using gmail....spooky..

McGiver
February 19th, 2006, 11:28 AM
... the sharks know everything ...

Joppe
February 19th, 2006, 01:45 PM
wtf :lol: