function AddRocks()
{
   %max = getRandom(600, 825);
   
   %masterX = getWord($Battlegrid.GetPosition(), 0);
   %masterY = getWord($Battlegrid.GetPosition(), 1);
   
   for(%i=1;%i<=%max;%i++)
   {
      %rock = getRandom(1, 11);
      %x = getRandom(-400, 400);
      %y = getRandom(-400, 400);
      
      %x = %masterX+%x;
      %y = %masterY+%y;
      
      switch$ (%rock)
      {
         case 1:
            %size = getRandom(1, 3) SPC getRandom(1, 3); 
            %obj = new t2dStaticSprite() {
               imageMap = "rock1";
               size = %size;
               scenegraph = "sg";
               layer = "9";
               frame = "0";
               CollisionActiveSend = "0";
            };
         
         case 2:
            %size = getRandom(1, 3) SPC getRandom(1, 3); 
            %obj = new t2dStaticSprite() {
               imageMap = "rock2";
               size = %size;
               scenegraph = "sg";
               layer = "9";
               frame = "0";
               CollisionActiveSend = "0";
            };
         
         case 3:
            %size = getRandom(5, 10) SPC getRandom(5, 10); 
            %obj = new t2dStaticSprite() {
               imageMap = "rock3";
               size = %size;
               scenegraph = "sg";
               layer = "9";
               frame = "0";
               CollisionActiveSend = "0";
            };
         
         case 4:
            %size = getRandom(5, 10) SPC getRandom(5, 10); 
            %obj = new t2dStaticSprite() {
               imageMap = "rock4";
               size = %size;
               scenegraph = "sg";
               layer = "9";
               frame = "0";
               CollisionActiveSend = "0";
            };
         
         case 5:
            %size = getRandom(5, 10) SPC getRandom(5, 10); 
            %obj = new t2dStaticSprite() {
               imageMap = "rock5";
               size = %size;
               scenegraph = "sg";
               layer = "9";
               frame = "0";
               CollisionActiveSend = "0";
            };
         
         case 6:
            %size = getRandom(1, 3) SPC getRandom(1, 3); 
            %obj = new t2dStaticSprite() {
               imageMap = "rock6";
               size = %size;
               scenegraph = "sg";
               layer = "9";
               frame = "0";
               CollisionActiveSend = "0";
            };
         
         case 7:
            %size = getRandom(1, 3) SPC getRandom(1, 3); 
            %obj = new t2dStaticSprite() {
               imageMap = "rock7";
               size = %size;
               scenegraph = "sg";
               layer = "9";
               frame = "0";
               CollisionActiveSend = "0";
            };
         
         case 8:
            %size = getRandom(5, 8) SPC getRandom(5, 8); 
            %obj = new t2dStaticSprite() {
               imageMap = "rock8";
               size = %size;
               scenegraph = "sg";
               layer = "9";
               frame = "0";
               CollisionActiveSend = "0";
            };
         
         case 9:
            %size = getRandom(1, 3) SPC getRandom(1, 3); 
            %obj = new t2dStaticSprite() {
               imageMap = "rock9";
               size = %size;
               scenegraph = "sg";
               layer = "9";
               frame = "0";
               CollisionActiveSend = "0";
            };
         
         case 10:
            %size = getRandom(5, 8) SPC getRandom(5, 8); 
            %obj = new t2dStaticSprite() {
               imageMap = "rock10";
               size = %size;
               scenegraph = "sg";
               layer = "9";
               frame = "0";
               CollisionActiveSend = "0";
            };
         case 11:
            %size = getRandom(5, 8) SPC getRandom(5, 8); 
            %obj = new t2dStaticSprite() {
               imageMap = "rock11";
               size = %size;
               scenegraph = "sg";
               layer = "9";
               frame = "0";
               CollisionActiveSend = "0";
            };
      }
      
      %randrotation = getRandom(1, 359);
      %obj.setPosition(%x SPC %y);      
      %obj.SetRotation(%randrotation);

      if($ObjectList $= "")
         $ObjectList = %obj;
      else
         $ObjectList = $ObjectList SPC %obj;            
   }
}

function AddFoilage()
{
   %max = getRandom(400, 625);

   %x = getWord($Battlegrid.GetPosition(), 0);
   %y = getWord($Battlegrid.GetPosition(), 1);
   
   for(%i=1;%i<=%max;%i++)
   {
      %foilage = getRandom(1, 1);
      %x = getRandom(-400, 400);
      %y = getRandom(-400, 400);
      
      switch$ (%foilage)
      {
         case 1:
            %size = getRandom(2, 5) SPC getRandom(2, 5); 
            %obj = new t2dStaticSprite() {
               imageMap = "tree1";
               size = "3 3";
               scenegraph = "sg";
               layer = "9";
               frame = "0";
               CollisionActiveSend = "0";
            };
      }
      
      %randrotation = getRandom(1, 359);
      %obj.setPosition(%x SPC %y);      
      %obj.SetRotation(%randrotation);

      if($ObjectList $= "")
         $ObjectList = %obj;
      else
         $ObjectList = $ObjectList SPC %obj;      
   }
}