Graviquarium 10

repulsion when opposite

What?

var NumberOfSquares=10;
var NetscapeSlownessFactor=1; 
var speed=50;
var gravitation=1.3; 
var attraction=80;
function collision(SquareNum){
   ......
   for (j=0; j<NumberOfSquares; j++){
      if(j!=SquareNum){
         ......
         if ( ( Math.abs(x1+w1/2-(x2+w2/2)) < hardshell * (w2+w1)/2 ) && ( Math.abs(y1+h1/2-(y2+h2/2)) < hardshell * (h2+h1)/2 ) )
         {
         ......
         }
         else {
             if ((gravX[SquareNum] == - gravX[j]) && (gravY[SquareNum] == - gravY[j])) {
                ......
                attractiveForce= - m1*m2*attraction/distanceSquare;
                ......
             }
         }
      }
   }
 
}

How?

both attraction and repulsion

What's next??

 
© 2003 AndreasKrueger.de (Impressum) letzte Änderung am: 03.09.2003 (AK v01)  http://www.AndreasKrueger.de/javascript