00:00
00:00
Newgrounds Background Image Theme

FylypFimpossible just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

AS: Artificial Thinking

8,675 Views | 30 Replies
New Topic Respond to this Topic

Response to AS: Artificial Thinking 2007-10-24 23:04:02


I know it's and old post, but this script really help me.

Also:

you can solve the problem for the constant check of far MC, with some modifications:

onClipEvent (load) {
searchRadius = 0;
distance = 0;
xDist = 0;
yDist = 0;
}
onClipEvent (enterFrame) {
searchRadius = searchRadius+10; // change here
for (i=0; i<10; i++) {
xDist = _x-_root["ball"+i]._x;
yDist = _y-_root["ball"+i]._y;
distance = Math.sqrt(Math.pow(xDist, 2)+Math.pow(yDist, 2));
if (distance<searchRadius) {
searchRadius = distance;
trace(i); //and now it will trace always just nearest (always)
}
}
}

So now instead of every frame check from a radious of 1000 to less, it will check from 0 to up. (increasing the radious until it found something, then it just change for an interval of 10)

Great code vengeance

sorry all for the bad english