title: "game" loop in flash virtual pond
body: <p>i am having trouble on designing the "game" loop in my flash as3 virtual pond currently  i have the following enter_frame loop. in my "pond" parent container, there will be arbitrary amount of "fish" objects and "food pellet" objects. currently in my loop function when two or more food is placed in near distance of the fish , the fish will not move does anyone know why this happens? </p>
  
  <p>the below code is in my "Fish" class, updatePosition() merely tells the fish to swim around like a fish.</p>
  
  <pre><code>public function loop(e:Event):void
          {
              //getDistance(this.x - i.x, this.y - i.y)
              if(foodDroppedArray.length &gt; 0)
              {
  
                  for each (var i:Food in foodDroppedArray)
                  {
  
                      if (getDistance(this.x - i.x, this.y - i.y) &lt; 100)
                      {
  
                          this.moveToFood(i);
  
                      }else {
                          updatePosition();
                      }
                  }
  
              }else 
              {
              updatePosition();
              }
  
          }
  </code></pre>