M3wThr33
01-17-2002, 07:24 AM
See that signature below this text? I've been working on it for a while. Anywho, I've been working to get that Aquarium customizable for quite some time. How do I get a function to return two variables...? It's not the same as C++!
The function in question:
function dirCalc (fishM, fishie) {
fishM._dist--;
if (fishM._dist < 1) {
fishM._dist = random(30);
fishM._dir = random(360);
fishM._xV = Math.cos(Math.PI/180 * fishM._dir);
fishM._yV = Math.sin(Math.PI/180 * fishM._dir);
}
if (((fishie._x > 0)&&(fishM._xV < 0))||((fishie._x < 500)&&(fishM._xV > 0))) {
setProperty (fishie, _x, fishie._x + fishM._xV);
}
if (((fishie._y > 0)&&(fishM._yV < 0))||((fishie._y < 30)&&(fishM._yV > 0))) {
setProperty (fishie, _y, fishie._y + fishM._yV);
}
}
I need to have both fishM and fishie returned in their new forms.
Right now the calculation may seem excessive, but I am also adding rotation and other nifty stuff. Right now, it just doesn't work!
The function in question:
function dirCalc (fishM, fishie) {
fishM._dist--;
if (fishM._dist < 1) {
fishM._dist = random(30);
fishM._dir = random(360);
fishM._xV = Math.cos(Math.PI/180 * fishM._dir);
fishM._yV = Math.sin(Math.PI/180 * fishM._dir);
}
if (((fishie._x > 0)&&(fishM._xV < 0))||((fishie._x < 500)&&(fishM._xV > 0))) {
setProperty (fishie, _x, fishie._x + fishM._xV);
}
if (((fishie._y > 0)&&(fishM._yV < 0))||((fishie._y < 30)&&(fishM._yV > 0))) {
setProperty (fishie, _y, fishie._y + fishM._yV);
}
}
I need to have both fishM and fishie returned in their new forms.
Right now the calculation may seem excessive, but I am also adding rotation and other nifty stuff. Right now, it just doesn't work!